<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="../angular/angular.js"></script>
<script>
var app=angular.module("myapp",[]);
app.controller("myctrl",function($scope){
});
//自定义指令
app.directive("myDirective",function(){
return{
restrict :"ECAM",
replace :true,
template:"<p>我的自定义指令</p>"
};
});
</script>
</head>
<body ng-app="myapp" ng-controller="myctrl">
<!--自定义标签指令-->
<my-directive></my-directive>
<!--属性标签指令-->
<p my-directive></p>
<!--类标签指令-->
<p class="my-directive"></p>
<!--注释指令换标签-->
<!-- directive:my-directive -->
</body>
</html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="../angular/angular.js"></script>
<script>
var app=angular.module("myapp",[]);
app.controller("myctrl",function($scope){
});
//自定义指令
app.directive("myDirective",function(){
return{
restrict :"ECAM",
replace :true,
template:"<p>我的自定义指令</p>"
};
});
</script>
</head>
<body ng-app="myapp" ng-controller="myctrl">
<!--自定义标签指令-->
<my-directive></my-directive>
<!--属性标签指令-->
<p my-directive></p>
<!--类标签指令-->
<p class="my-directive"></p>
<!--注释指令换标签-->
<!-- directive:my-directive -->
</body>
</html>