首页 > 代码库 > 简单的自定义指令

简单的自定义指令

<!DOCTYPE html>
<html ng-app="myApp" >
<head lang="en">
<meta charset="UTF-8">
<title>T2</title>
<script src="http://www.mamicode.com/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",
template:"<h1>自定义的指令!</h1>"
};
});



</script>
</html>

简单的自定义指令