$routeParams doesn't work in resolve function

前端 未结 1 1571
我在风中等你
我在风中等你 2020-12-22 18:49

I\'m using this technique to load data. So I have created the following resolve function:

NoteController.resolve = {
    note: function($routeParams, Note)          


        
相关标签:
1条回答
  • 2020-12-22 19:18

    You need to use $route.current.params.key instead. The $routeParams is updated only after a route is changed. So your code should look along those lines:

    NoteController.resolve = {
        note: function($route, Note) {
             return Note.get($route.current.params.key);
        }
    }
    
    0 讨论(0)
提交回复
热议问题