I'm studying how to consume Angled WebApi for this site . Everything was going well until I gave this error:
angular.js:13550 Error: Could not resolve 'stateOne' from state ''
at Object.v.transitionTo (angular-ui-router.min.js:7)
at Object.v.go (angular-ui-router.min.js:7)
at angular-ui-router.min.js:7
at angular.js:19157
at e (angular.js:5869)
at angular.js:6145
I tried to search for something like this but could not find an explanation. From what I've looked it looks like this is a problem loading javascript files.
Follow the application module code:
// Módulo da aplicação
var AwesomeAngularMVCApp = angular.module('AwesomeAngularMVCApp', ['ui.router', 'ui.bootstrap']);
// Controllers
AwesomeAngularMVCApp.controller('LandingPageController', LandingPageController);
AwesomeAngularMVCApp.controller('LoginController', LoginController);
AwesomeAngularMVCApp.controller('RegisterController', RegisterController);
// Factories
AwesomeAngularMVCApp.factory('LoginFactory', LoginFactory);
AwesomeAngularMVCApp.factory('RegistrationFactory', RegistrationFactory);
AwesomeAngularMVCApp.factory('AuthHttpResponseInterceptor', AuthHttpResponseInterceptor);
var configFunction = function ($stateProvider, $httpProvider, $locationProvider) {
$locationProvider.hashPrefix('!').html5Mode(true);
$stateProvider
.state('stateOne', {
url: '/stateOne?donuts',
views: {
"containerOne": {
templateUrl: '/routesDemo/one'
},
"containerTwo": {
templateUrl: function (params) {
return '/routesDemo/two?donuts=' + params.donuts;
}
}
}
})
.state('stateTwo', {
url: '/stateTwo',
views: {
"containerOne": {
templateUrl: '/routesDemo/one'
},
"containerTwo": {
templateUrl: '/routesDemo/three'
}
}
})
.state('stateThree', {
url: '/stateThree?donuts',
views: {
"containerOne": {
templateUrl: function (params) {
return '/routesDemo/two?donuts=' + params.donuts;
}
},
"containerTwo": {
templateUrl: '/routesDemo/three'
}
}
})
.state('loginRegister', {
url: '/loginRegister?returnUrl',
views: {
"containerOne": {
templateUrl: '/Account/Login',
controller: LoginController
},
"containerTwo": {
templateUrl: '/Account/Register',
controller: RegisterController
}
}
});
$httpProvider.interceptors.push('AuthHttpResponseInterceptor');
}
configFunction.$inject = ['$stateProvider', '$httpProvider', '$locationProvider'];
Follow the controller code:
var LandingPageController = function ($scope) {
$scope.models = {
helloAngular: 'Eu consigo!'
};
$scope.product = {
produto: 'Rotas'
};
$scope.navbarProperties = {
isCollapsed: true
};
}
/* The $inject property of every controller (and pretty much every other type of object in Angular)
* needs to be a string array equal to the controllers arguments, only as strings
**/
LandingPageController.$inject = ['$scope'];
I will be very grateful for some explanation on how to resolve this error.