I have a template and two routes, none open on page load (or F5), but if I make a $ state.go ('RotateName '), it loads properly.
// routes.js
angular.module('app').config([
'$stateProvider', '$urlRouterProvider', '$locationProvider',
function ($stateProvider, $urlRouterProvider, $locationProvider) {
console.log('Register routes...');
$urlRouterProvider.otherwise("/demo-register");
$stateProvider.state('quickRegister', {
url: '/quick-register',
templateUrl: 'path/para/quick-register.html',
controller: 'QuickRegisterController'
}).state('demoRegister', {
url: "/demo-register",
templateUrl: 'path/para/demo-register.html',
controller: 'DemoRegisterController'
});
}]);
<!-- template.html -->
<div class="main" ng-controller="CleanController">
<div id="header">
<div class="container">
<img ng-src="{{headerSrc}}">
<hr>
</div>
</div>
<div id="content" ui-view></div>
</div>
angular.module('app').controller('CleanController', [
'$scope', '$state',
function ($scope, $state) {
console.log('$state.current', $state.current)
// output: $state.current {name: "", url: "^", views: null, abstract: true}
}
]);
Note that in CleanController I gave a console.log from the current state , and it returned a "blank" state, but at no time did I set this state .
Does anyone have any ideas how to fix the problem?