我有一个带路由的AngularJS JavaScript代码:
.when("/home/:id", {
templateUrl: " ",
controller: "TestController",
resolve: {
message: function(app, helpers, $route){
console.log($route);
return app.get({
user: 533,
id: 2
}).then(function (response) {
console.log($route);
return helpers.toArray(response.app);
});
}
}
});
我的HTML链接为:
<a href="#/home/1">Click</a>
我的TestController
也是:
.controller('TestController', ['$scope', '$http', '$routeParams', 'message', function ($scope, $http, $routeParams, message) {
$scope.appointments = message;
}])
当我尝试$route
中的resolve
时,如:
console.log($route);
我一无所获。