<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<div ng-app="myApp">
<script type="text/ng-template" id="customTags2">
<div>
hello {{name}}
</div>
</script>
<div ng-controller="firstController">
<custom-tags></custom-tags>
<custom-tags2></custom-tags2>
</div>
</div>
<script src="//cdn.bootcss.com/angular.js/1.4.8/angular.js"></script>
<script type="text/javascript" src="app/index.js"></script>
</body>
</html>
var myApp = angular.module('myApp', [])
.directive('customTags', function () {
return {
restrict: 'ECAM',
templateUrl: 'tmp/other.html',
replace: true
}
})
.directive('customTags2', function () {
return {
restrict: 'ECAM',
templateUrl: 'customTags2',
replace: true
}
})
.controller('firstController', ['$scope', function ($scope) {
$scope.name = '张三';
}]);