Angular Sporadic knowledge point 2

Source: Internet
Author: User

Iv. ng-if, Ng-show, Ng-switch

Reference: Angularjs's learning--ng-show/ng-hide/ng-if and Ng-switch

Simple summary:

Ng-show and ng-hide simply show or hide the DOM nodes, and the nodes will still be loaded and rendered

Ng-if, like Ng-show, receives a bool, but when Ng-if is false, the DOM node it controls is not created or the previous DOM node is destroyed, which speeds up the DOM loading

Ng-switch omitted the Tab tab trouble, it listens to a variable, the variable value is a, a control of the DOM node will be created to display, the variable value is B, A's DOM node is destroyed, B's DOM node is created

Ng-switch is useless, here is a small example:

<script type= "Text/javascript" >var Democtrl = function ($scope) {$scope. Showmode = "a"; $scope. Changeshow = function (Showmode) {$scope. Showmode = Showmode;}}; </script>

  

Angular Sporadic knowledge point 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.