16.简单的自定义指令

<!DOCTYPE html>
<html ng-app="myApp" >
<head lang="en">
<meta charset="UTF-8">
<title>T2</title>
<script src="js/angular.js" type="text/javascript"></script>

</head>
<body>

<p class="run-directive"></p>


</body>

<script>
var app=angular.module("myApp",[]);
app.directive("runDirective", function () { //去掉横杠,d大写
return{
restrict:"C", //E:标签 A:属性 C:类别 M:注释
template:"<h1>自定义的指令!</h1>"
};
});



</script>
</html>
原文地址:https://www.cnblogs.com/mx2036/p/6705022.html