I’m using this technique to load data. So I have created the following resolve function:
NoteController.resolve = {
note: function($routeParams, Note) {
return Note.get($routeParams.key);
}
}
The problems is that $routeParams.key is undefined at the moment of resolve function execution. Is it correct/bug? How can I fix it?
You need to use
$route.current.params.keyinstead. The$routeParamsis updated only after a route is changed. So your code should look along those lines: