Ngcloak
The ngcloak command is used to prevent the angular template from flashing when it is loaded from the browser. Use it to avoid flickering issues.
This command can be applied to <body> elements, but multiple ngcloak commands are preferred to be applied to a small part of the page, allowing progressive display of browser views. Ngcloak works with the following CSS rules embedded into the corner. JS and angular. Min. js. Add the angular-CSP mode. CSS and HTML files (see ngcsp ).
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {display: none !important;}
When this CSS rule is loaded by a browser, all HTML elements (including children) are marked with the ngcloak command, which is hidden. When angular is compiled, it deletes the ngcloak element attribute to make the compilation element visible.
For the best effect, angular scripts must load the header of the HTML document, or the preceding CSS rules must be included in the external style sheet of the application.
Ngcontroller
Ngcontroller adds a controller class to the view,
This is a key principle behind angular's support for Model-View-controller design patterns. Angular MVC component: Model-model is a range attribute; scope is attached to the DOM attribute by binding the access range. View-the data binding template (HTML) is displayed to the view. The Controller-ngcontroller command specifies a controller class that contains the range of applications and functions and values used. And directive info command to create a new range. This command has a priority of 500. Usageas attribute:
<ANY ng-controller="">...</ANY>
Arguments
Param |
Type |
Details |
Ngcontroller |
Expression |
$ Controllerprovider or expression registers the constructor name and evaluates a constructor for the current range. By formulating ng-controller = "as propertyname", the control instance can publish attributes to a specific range.
If the current $ controllerprovider is configured to use the global variable ($controllerProvider.allowGlobals() ) To access the constructor with a global name (not recommended) |
This is a simple form for editing user contact information. Add, delete, clear, and greet the methods declared in the Controller (see the source tab ). These methods can be easily marked from angular. Any changes are automatically reflected in the view without manual updates. Two different declaration styles are as follows: one way to directly control attributes using this: NG-controller = "settingscontroller1 as Settings" One way to inject $ scope into the controller: NG-controller = "settingscontroller2" the second choice is more common in the angular community. It is generally used for templates and guides. However, property controllers are directly bound to avoid range. When multiple controllers control elements with the same name, use controller as to make your template more obvious. If you are writing your controller class, it is easier to obtain attributes and methods. This will appear in the scope, controller internal code. Because there is always. In binding, you don't have to worry about prototype inheritance blocking primitives.
Directive (Part 2) under angular)