Reputation: 4573
This is my first angular project and I'm using angular "ui.router" in my application. This is structure of my application
I have created separate route file for each module and all module inject in app.js. When I run my application my home module routing works fine but account module routing gives below error:
**"Error: Could not resolve 'login' from state '' transitionTo................
but when I create my account module controller direct in route file it's works. I'm stuck on this
Can any one resolve this issue?
Upvotes: 0
Views: 60
Reputation: 2325
Inject the uiRouter module in your parent module config your states.
var myApp = angular.module('myApp',['ui.router']);
myApp.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise("/state1");
// Now set up the states
$stateProvider
.state('state1', {
url: "/state1",
templateUrl: "partials/state1.html"
})
.state('state1.list', {
url: "/list",
templateUrl: "partials/state1.list.html",
controller: function($scope) {
$scope.items = ["A", "List", "Of", "Items"];
}
})
.state('state2', {
url: "/state2",
templateUrl: "partials/state2.html"
})
.state('state2.list', {
url: "/list",
templateUrl: "partials/state2.list.html",
controller: function($scope) {
$scope.things = ["A", "Set", "Of", "Things"];
}
});
});
Upvotes: 0