Created
August 24, 2012 19:13
-
-
Save johnlindquist/3454549 to your computer and use it in GitHub Desktop.
resolve $routeParams bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//broken | |
when("/edit/:id", {templateUrl:"/partials/edit.html", controller:"EditCtrl", | |
resolve:{person:function ($q, crewResource, $routeParams) { | |
var deferred = $q.defer(); | |
crewResource.get({id:$routeParams.id}, function (results) { | |
deferred.resolve(results); | |
alert(results); | |
}) | |
return deferred.promise; | |
}}}) | |
//works | |
when("/edit/:id", {templateUrl:"/partials/edit.html", controller:"EditCtrl", | |
resolve:{person:function ($q, crewResource, $route) { | |
var deferred = $q.defer(); | |
crewResource.get({id:$route.current.params.id}, function (results) { | |
deferred.resolve(results); | |
alert(results); | |
}) | |
return deferred.promise; | |
}}}) |
oops nevermind Just saw the post bellow the code that was broken lool thanks :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How were you able to solve this ? I'm currently facing exactly the same issue I'd like to load data with params in the url before the controller and template are generated :(