Search Posts

Category: angularjs-ng-switch

Angularjs custom component vs ngSwitch directive compilation order

There is a following code snippet: <my-header></my-header> <div ng-switch=”$”> <div ng-switch-when=”1″><component1></component1></div> <div ng-switch-when=”2″><component2></component2></div> <div ng-switch-when=”3″><component3></component3></div> </div> I want that component myHeader would be constructed before ngSwitch directive takes an action. Now component1 is constructed before myHeader. Routing represents following code: $stateProvider .state({ name: ‘myApp’, url: ‘/’, component: ‘loader’, }) .state({ name: ‘myApp.pages’, url: ‘pages/{id:int}’, component: ‘loader’ }); $urlRouterProvider.otherwise(‘/pages/1’); Source: AngularJS