首页 > 代码库 > angular.js创建自定义指令-demo3

angular.js创建自定义指令-demo3

html:

<!doctype html>
<html ng-app="myModule">
<head>
<meta charset="utf-8">
</head>
<body>
<hello></hello>
</body>
<script src="http://www.mamicode.com/js/angular-1.3.0.js"></script>
<script src="http://www.mamicode.com/HelloAngular_Directive.js"></script>
</html>

 

js:

var myModule = angular.module("myModule",[]);
myModule.directive("hello",function(){
return {
restrict:‘E‘,//E代表标签
template:‘<div>Hillo----angular自定义标齐</div>‘,
replace:true
}
});

angular.js创建自定义指令-demo3