I am trying to separate my application in modules. I have a login module and the rest of the application. My idea is that the user can not access the rest of the app without having to login at first. For that I use two angular.module with different configurations but I can't seam to dynamically have angular resolve the new app.js and use it's configuration on my webapp.
//index.html
<div data-ng-app="login" ui-view></div>
//login.js
.state('user.signin', {
url: '/signin',
templateUrl: 'login.html'
})
.state('appUIView', {
url: '/appUIView',
templateUrl: 'appUIView.html',
resolve: {
deps: ['uiLoad',
function( uiLoad ){
return uiLoad.load( [
'js/app.js'//I try resolving the app.js so I can now use it's configuration
]);
}]
}
})
//appUIView.html
<div data-ng-app="app" ui-view></div>//uses the app defined in app.js
//app.js
$urlRouterProvider
.otherwise('/app');//when app.js is loaded if the new configuration is used the page should land on app.html
$stateProvider
.state('app', {
url: '/app',
templateUrl: 'app.html'
})
http://plnkr.co/edit/FOAegZmmWjuPeWp3VhBe
Thanks for the help!