Angularjs: How does the Angular hide and show elements?where should I modify the elements? -


i'd hide angular app until view rendered. propable have hide using style="display:none":

 <div id="app-content" style="display:none">       <!-- angular app html code -->  </div> 

i have tried this, won't work, because angular not modify style.display value.

<div id="app-content" style="display:none" ng-show="1"> 

how angular hide elements, should modify style.display, or there better solution?

how angular show , hide elements?

this depends on boolean (true or false) value


ng-show :

  • ng-show="true" same style="display:block"
  • ng-show="false" same style="display:none"

ng-hide :

this same ng-show depends on true or false value

  • ng-hide="true" same style="display:none"
  • ng-hide="false" same style="display:block"

if use ng-show or ng-hide, don't need call display properties in style


where should modify style.display, or there better solution?

you don't need style.display if using angular.js. try ng-show , ng-hide.

if use ng-show or hide, can changes in controller.

like below

<div  ng-show="modelname">...... 

you need modify modelname in controller.

function controllername($scope) { $scope.modelname="true"// or false } 


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -