<!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", template:"<h1>自定义的指令!</h1>" }; }); </script></html>
时间: 2024-10-06 01:04:54