限制你的指令只能通过特定的方式来调用
2017-02-06 14:12
225 查看
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
</head>
<body ng-app="myApp">
<div runoob-directive></div>
</body>
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script>
var app = angular.module("myApp",[]);
app.directive("runoobDirective",function(){
return {
restrict:"A",
template:"<h1>只能通过属性的方式来调用</h1>"
}
});
</script>
</html>
说明:
restrict 值可以是以下几种:
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
</head>
<body ng-app="myApp">
<div runoob-directive></div>
</body>
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script>
var app = angular.module("myApp",[]);
app.directive("runoobDirective",function(){
return {
restrict:"A",
template:"<h1>只能通过属性的方式来调用</h1>"
}
});
</script>
</html>
说明:
restrict 值可以是以下几种:
E作为元素名使用
A作为属性使用
C作为类名使用
M作为注释使用
相关文章推荐
- spring-mvc @RequestMapping 限制方法只能以特定的方式访问
- 通过COM组件方式实现java调用C#写的DLL文件 转
- 通过设置Ant中java和junit的dir属性来解决ant脚本只能在特定目录下正常运行
- SilverLight通过Net.TCP(NetTCPBinding)方式调用WCF服务
- Java调用Delphi DLL(通过C++调用和直接调用两种方式)
- HTML 限制文本框只能输入特定字符(比如数字 onkeyup+onafterpaste)
- WCF服务通过 SvcUtil.exe 方式调用,WCF半动态调用
- 通过get或post的方式来调用web service
- ASP通过VBA方式调用EXCEL模版生成新的EXCEL (转)
- 类名方式来调用指令
- 通过接口方式调用服务里面的方法
- ios开发,javascript直接调用oc代码而非通过改变url回调方式
- ios开发,javascript直接调用oc代码而非通过改变url回调方式
- 听见丨酷骑修改退押金方式,用户将只能通过电话退款 苹果3000万美元收购增强现实初创企业Vrvana
- JBoss4.2的启动方式-Jboss无法通过IP地址访问,只能用localhost访问
- 通过客户端编程的方式调用webservice
- 编译安装spawn-fcgi(nginx通过FastCGI方式调用PHP)
- 通过客户端编程的方式调用webservice
- ASP.NET不通过添加web引用的方式调用web service接口
- 通过web方式远程调用ANT编译(一)