<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body ng-app="myApp1"> <itbutton></itbutton> <itbutton1></itbutton1> <script src="./js/Angular.js"></script> <script> var myApp1 = angular.module('myApp1', []); //第一个参数是指令的名字 第二个参数应该使用一个数组 //数组的最后一个元素是一个函数 myApp1.directive('itbutton', [function() { return { template: '<div>geyao</div>' }; }]) myApp1.directive('itbutton1', [function() { return { template: '<div>geyao</div>' }; }]) </script> </body> </html>