Hi all

I recently decided to add Angular to an existing rails app but I'm having 
all the pain in the world making some of the features work.

lets say I have this resource:

http://localhost:3000/en/event/2/participants/5

How can I get the event ID param from the url in an angular controller?

I wrote this in my app setting:

@app.config([
  '$routeProvider', ($routeProvider)->
    $routeProvider.when(':locale/events/:id',
      {
        controller: 'eventsCtrl',
        resolve: {
          params: ['$route', ($route)->
            params = {id: $route.current.params.id}
          ]
        }
      }
    )
])



In my controller

@app.controller "eventsCtrl", ($scope, $routeParams, $location, $route)->
  console.debug $routeParams


In my events#show view I simply put

div(ng-controller="eventsCtrl")


Unfortunately I get an empty output for the routeParams.

What I'm I doing wrong here?

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to