javascript - Angular UI navbar collapse not working -


i can't seem navbar start collapsed below code. i'm using angular-ui-bootstrap:

navbar.directive.html:

<button type="button" ng-click="iscollapsed = !iscollapsed">   <span class="sr-only">toggle navigation</span>   <span class="icon-bar"></span>   <span class="icon-bar"></span> </button> <div collapse="iscollapsed">   <ul class="nav navbar-nav">     <li>test</li>     <li>testing...</li>   </ul> </div> 

navbar.controller.js:

angular.module('gameapp')   .controller('navbarcontroller', navbarcontroller);  navbarcontroller.$inject = ['playersservice'];  function navbarcontroller(playersservice) {   var vm = this;   vm.iscollapsed = true;    var getcurrentplayer = function() {     playersservice.getcurrentplayer().$promise.then(function(data) {       vm.player = data.player;     });   };    var init = function() {     getcurrentplayer();   };    init(); } 

when page minimized point responsive navbar toggle appears menu showing. if change vm.iscollapsed = false; menu still starts open.

controller built using this allow controlleras syntax variables in html set use $scope.

if directive not have isolated scope need declare alias controller somewhere , prefix variables alias.

--or--

need change controller bind variables $scope not this

not sure how directive configured or controller being declared in view


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -