文章图片
指令是文档对象模型(DOM)中的标记。指令可与任何控制器或HTML标记一起使用, 这将告诉编译器预期的确切操作或行为。存在一些预定义的指令, 但是如果开发人员希望他可以创建新指令(自定义指令)。
例子:本示例使用ng-app指令定义默认的AngularJS应用程序。
<
html>
<
head>
<
title>
AngularJS ng-app Directive<
/title>
<
script src=
"https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js" >
<
/script>
<
/head>
<
body style= "text-align:center" >
<
h2 style = "color:green" >
ng-app directive<
/h2>
<
div ng-app= "" ng-init= "name='lsbin'" >
<
p>
{{ name }} is the portal for geeks.<
/p>
<
/div>
<
/body>
<
/html>
【AngularJS指令完整参考指南】输出如下:
文章图片
下表列出了重要的内置AngularJS指令。
指令 | 描述 |
---|---|
ng-app | AngularJS应用程序的启动。 |
ng-init | 用于初始化变量 |
ng模型 | ng-model用于绑定到HTML控件 |
ng控制器 | 将控制器附加到视图 |
ng-bind | 将值与HTML元素绑定 |
ng-repeat | 对指定集合中的每个项目重复一次HTML模板。 |
ng-show | 显示或隐藏关联的HTML元素 |
ng只读 | 将HTML元素设置为只读 |
禁用ng | 用于动态禁用或启用按钮 |
ng-if | 删除或重新创建HTML元素 |
ng-点击 | 自定义点击步骤 |
- 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只读指令
- 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模式指令
- 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指令
推荐阅读
- Python中的numpy.subtract()用法详细介绍
- C++如何使用std::search(代码示例)
- Python Numpy介绍和用法经典指南
- JavaScript中的函数介绍和用法详细指南
- 如何TCP和UDP之间的区别()
- 如何实现SSTF磁盘调度算法程序()
- jQuery如何使用jTippy工具提示插件()
- 高盛面试经验分享(经验丰富)
- 电脑公司win7旗舰版笔记本系统32位最新系统推荐