<!doctype html>
<html ng-app="myapp">
<head>
<meta charset="utf-8"/>
</head>
<body>
<elementtag>E</elementtag>
<div attr>A</div>
<div class="classnamw">C</div>
<!-- 注意注释变量两侧必须加上空格 否则不会正确执行这个指令 -->
<!-- directive:commit -->
<div></div>
<script src="./js/angular.min.js"></script>
<script>
var app = angular.module('myapp',[]);
app.directive('elementtag',function(){
return {
restrict:"E", //元素指令
link:function(scope,element,attrs){
console.log("this is a element");
}
};
})
.directive('attr',function(){
return {
restrict:"A", //属性指令
link:function(scope,element,attrs){
console.log("this is a attribute");
}
};
})
.directive('classnamw',function(){
return {
restrict:"C", //class 指令
link:function(scope,element,attrs){
console.log("this is a class");
}
};
})
.directive('commit',function(){
return {
restrict:"M", //注释指令
link:function(scope,element,attrs){
console.log("this is a commit");
}
};
});
</script>
</html>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有