angularjs - I want to change ons-toolbar's display when the orientation changed -


my code follows :

<ons-page ng-controller="stockcontroller">      <ons-toolbar class="dcf"  id="stocktoolbar" ng-if = "orientation">         <div class="left">             <ons-back-button style="color:white;"></ons-back-button>         </div>          <div class="center" style="font-size:22px;" >stock</div>     </ons-toolbar>       <highchart id="chart1" config="chartconfig" class="span10"></highchart> </ons-page> 

controller follows:

if (math.abs(window.orientation) === 90) {     $scope.orientation = false;     $scope.$apply(); } else {     $scope.orientation = true;     $scope.$apply(); } window.onorientationchange = function(){     if (math.abs(window.orientation) === 90) {         $scope.orientation = false;         $scope.$apply();     } else {         $scope.orientation = true;         $scope.$apply();     } }  

i set ng-if="false" or ng-if="true" works fine, when run code, not work, toolbar forever display.

anybody can me solve problem?

can please use orientation boolean type, rather string $scope.$digest(); @ end of javascript function. tried in local working.

thanks


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -