AngularJS - How to pass up to date $routeParams to resolve?

后端 未结 1 739
说谎
说谎 2021-01-07 21:47

How do you pass current $routeParams to resolve so they can be used to do a specific $http.get. Right now I\'ve just tested $routeParams and passed back the param to be log

相关标签:
1条回答
  • 2021-01-07 22:45

    From the angular documentation for $routeProvider

    Be aware that ngRoute.$routeParams will still refer to the previous route within these resolve functions. Use $route.current.params to access the new route parameters, instead.

    So..

    SomeData: function( $route ) {
        return $route.current.params.paramType;
    }
    
    0 讨论(0)
提交回复
热议问题