Skip to content

Instantly share code, notes, and snippets.

@johnlindquist
Created August 24, 2012 19:13
Show Gist options
  • Save johnlindquist/3454549 to your computer and use it in GitHub Desktop.
Save johnlindquist/3454549 to your computer and use it in GitHub Desktop.
resolve $routeParams bug
//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;
}}})
@malikov
Copy link

malikov commented Jan 14, 2014

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 :(

@malikov
Copy link

malikov commented Jan 14, 2014

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