指令是文档对象模型(DOM)中的标记。指令可与任何控制器或HTML标记一起使用,这将告诉编译器预期的确切操作或行为。存在一些预定义的指令,但是如果开发人员希望他可以创建新指令(自定义指令)。
示例:本示例使用ng-app指令定义默认的AngularJS应用程序。
AngularJS ng-app Directive
ng-app directive
{{ name }} is the portal for geeks.
输出:
下表列出了重要的内置AngularJS指令。
Directives | Description |
---|---|
ng-app | Start of AngularJS application. |
ng-init | Used to initialise a variable |
ng-model | ng-model is used to bind to the HTML controls |
ng-controller | Attaches a controller to the view |
ng-bind | Binds the value with HTML element |
ng-repeat | Repeats HTML template once per each item in the specified collection. |
ng-show | Shows or hides the associated HTML element |
ng-readonly | Makes HTML element read-only |
ng-disabled | Use to disable or enable a button dynamically |
ng-if | Removes or recreates HTML element |
ng-click | Custom step on click |
指令:
- AngularJS |指令
- AngularJS | ng-list指令
- AngularJS |禁用ng的指令
- AngularJS | ng-mouseup指令
- AngularJS | ng-keyup指令
- AngularJS | ng-focus指令
- AngularJS | ng-keypress指令
- AngularJS | ng-hide指令
- AngularJS | ng-dblclick指令
- AngularJS | ng-mousedown指令
- AngularJS | ng-change指令
- AngularJS | ng-maxlength指令
- AngularJS | ng-blur指令
- AngularJS | ng-controller指令
- AngularJS | ng-mouseleave指令
- AngularJS | ng-bind指令
- AngularJS | ng-mouseenter指令
- AngularJS | ng-click指令
- AngularJS | ng-copy指令
- AngularJS | ng-mousemove指令
- AngularJS | ng-minlength指令
- AngularJS | ng-checked指令
- AngularJS | ng-if指令
- AngularJS | ng-cut指令
- AngularJS | ng-readonly指令
- AngularJS | textarea指令
- AngularJS |输入指令
- AngularJS | ng-include指令
- AngularJS | ng-jq指令
- AngularJS | ng-model指令
- AngularJS | ng-transclude指令
- AngularJS | ng-class-even指令
- AngularJS | ng-class-odd指令
- AngularJS | ng值指令
- AngularJS | ng-bind-template指令
- AngularJS | ng-form指令
- AngularJS | ng-bind-html指令
- AngularJS | ng级指令
- AngularJS | ng-pluralize指令
- AngularJS | ng-pattern指令
- AngularJS | ng样式指令
- AngularJS | ng-switch指令
- AngularJS | ng-show指令
- AngularJS | ng-srcset指令
- AngularJS | ng-src指令
- AngularJS | ng-submit指令
- AngularJS | ng-app指令
- AngularJS | ng-href指令
- AngularJS | ng要求的指令
- AngularJS | ng-init指令
- AngularJS | ng-paste指令
- AngularJS | ng-open指令
- AngularJS | ng-options指令
- AngularJS | ng选择的指令
- AngularJS | ng-non-bindable指令