1
Have State Route:Angular js nicht lösen arbeiten
.state('stateProfile', {
url: '/Profile',
views: {
"ContentContainer": {
templateUrl: '/Navigation/Profile',
controller: AuthController,
resolve: {
message: function (AuthService) {
return AuthService.GetMessage();
}
}
}
Das ist mein Service:
var AuthService = function ($timeout, $q, $location) {
return{
GetMessage : function() {
return "Hello";
}
}
};
AuthService.$inject = ['$timeout', '$q', '$location'];
Controller:
var AuthController = function (message, $q, $location, $timeout) {
console.log('auth work');
console.log(message);
};
AuthController.$inject = ['message', '$q', '$location', '$timeout'];
Wenn ich anrufe, passiert nichts Profil Staat. Aber wenn ich meine Auflösung zu ändern:
resolve:
{
message: function (AuthService) {
return "Test resolve";
}
Dann funktioniert alles. Warum funktioniert es nicht?