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

时间:2023-03-08 16:06:51

html:

<!doctype html>
<html ng-app="myModule">
<head>
<meta charset="utf-8">
</head>
<body>
<hello></hello>
</body>
<script src="js/angular-1.3.0.js"></script>
<script src="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
}
});