Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Val's Profile

GitHub User: val-litvak

Site: vallitvak.com

Comments by Val

Avatar
  • I think what you are looking for is setting up routes. In order to be able to use routeParams in your controller, you must first set up routes. There is good documentation for setting up routes here: http://docs.angularjs.org/tutorial/step_07

  • When you are finished setting up routes, you can then use routeParams in your controller. There is an angular service called $routeParams, which you can pass in just like the other 2 services($scope and $resource).
    Ex:

@ForumCtrl = ($scope, $resource, $routeParams) ->
  # more code ...

Note: When you want to retrieve a single record, Topic.query() won't work, you must use Topic.get({id: my_id_here})
Ex:

@ForumCtrl = ($scope, $resource, $routeParams) ->
  Topic = $resource("/forums/:id", {id: "@id"})
  $scope.topics = Topic.get({id: $routeParams.id})

In the angularjs documentation you can find another example of this: http://docs.angularjs.org/tutorial/step_11

and more about using $resource here:
http://docs.angularjs.org/api/ngResource.$resource

Avatar

Awesome RailsCast!

I've been using angular for about 5 months now and it's been a great experience.

Personally I prefer it over Backbone and Ember, both of which I attempted to learn before I discovered AngularJS.

With Backbone, it seemed like I had to write a ton of boilerplate code to get anything working, and my code would get cluttered quickly.

After attempting Backbone, I tried to go with Ember. However, it seemed like it was under such heavy development, that finding good(current) tutorials/documentation was very difficult, which is important to anyone who is starting out to learn something new.

Avatar

I am running into the same issue and can't seem to figure out how to fix it, have you been able to figure it out yet?

Avatar

Because if you notice on the outside of the if statment, you have the respond_to block, I ran into the same issue at first as well.

So if you don't wrap it in format.html { }, the action won't know what to do.

Avatar

Meteor looks awesome! I would love to see another screencast on meteor, perhaps with more advanced concepts