Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I want to send parameters to my Controller using the router.go redirection.

I tried this :

 this._router.go('game', {'data': 'myData'});

Is it possible to get the parameters like that :

GameController(this._scope, this._router){
  print(this._router.parameters['data']);
}

If I want to "print" that, it returns null.

share|improve this question

1 Answer 1

I've ran into this myself. I don't know if its the way to do it, but it works:

In your routes, you have to add the parameter 'data' to 'game', something like:

..addRoute(name: "game", 
   path: "/game/:data", 
   enter: view("views/game.html"))

after this you are able to fetch the parameter with:

GameController(this._scope, this._router){
    print(this._router.parameters['data']);
}

Seems like you have to introduce all the parameters you want to use to Angulars Routes before.

BR

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.