angularjs - Angular UI Router running footer function when navigating to a state with no footer -
i'm building angular 1.x app, using ui-router. when navigate state 'a', header, content, , footer load properly. when navigate away state 'b', footer.getlabel running after 'b' content loads, though state doesn't have ui-view footer. ideas?
http://jsfiddle.net/rsmclaug/vhrh0av5/
index.html snippet
<header ui-view="header"></header> <div ui-view="content"></div> <footer ui-view="footer"></footer> routing config snippet
.state('a', { url: '/a', views: { header: { templateurl: '/header.html', controller: 'headercontroller', controlleras: 'header' }, content: { templateurl: '/content.html', controller: 'contentcontroller', controlleras: 'content' }, footer: { templateurl: '/footer.html', controller: 'footercontroller', controlleras: 'footer' } } }) .state('b', { url: '/b', views: { header: { templateurl: '/header.html', controller: 'headercontroller', controlleras: 'header' }, content: { templateurl: '/content.html', controller: 'contentcontroller', controlleras: 'content' }, footer: {} } }); footer.html snippet
<button>{{footer.getlabel()}}</button> footer.js snippet
footer.getlabel = function(){ // executes when arriving @ state 'b' 'a' };
Comments
Post a Comment