angular ui router - Angularjs $stateProvider and singleton service issue -


i using angular-ui-router make app organized routing little confused. know have add 'ui-router' dependencie in module use $stateprovider. though not add 'ui-router' dependencie, working well.

i know angular service singleton object if add 'ui-router' dependencie once. can use $stateprovider service in module?

below code angular code defined in app.

angular.module('app', ['ui-router','app.pages']);  angular.module('app.pages', ['app.pages.core']);   angular.module('app.pages.core',[])     .config(function ($stateprovider, $urlrouterprovider) {      $stateprovider         .state('common.default', {             abstract: true,             views: {                 header: {                     templateurl: '/public/app/common/components/header/header.html',                     controller: 'headercontroller'                  },                 content: {                     template: '<div ui-view></div>'                 }             }         })         .state('common.default.core', {             url: "/goongles/",             templateurl: "/public/app/pages/core.html",             controller: 'corecontroller'         }); }); 

view code

<div ui-view="header"></div> <div ui-view="content" class ='view ng-scope openm'></div> 

please give me idea. thanks

think of tree. root of tree whatever module set in ng-app directive. when angular it's bootstraping, starts there, , loads of module components , dependencies' components. once bootstrap finished, lifecycle continues (creating constants, providers, running config blocks, etc).

since somewhere in app have dependency ui-router, of services become available after bootstrap.

regardless of that, shouldn't rely on modules work. if use app.pages.core module in application doesn't have dependency ui-router, wouldn't work.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -