首页 > 代码库 > 开通尝试
开通尝试
angular自定义标签
<!DOCTYPE html>
<html lang="en" ng-app=‘myApp‘>
<head>
<meta charset="utf-8">
<script src="http://www.mamicode.com/js/angular.min.js"></script>
<script>
var m1 = angular.module(‘myApp‘,[]);
m1.controller(‘Aaa‘,[‘$scope‘,function($scope){
$scope.name=‘hello‘;
}])
m1.directive(‘hi‘,function(){
return{
restrict:"AEC",
template:"<p>angularJs</p>",
replace:true
}
})
</script>
</head>
<body ng-controller=‘Aaa‘>
<p>{{name}}</p>
<!-- <hi></hi> -->
<!-- <div hi></div> -->
<div class="hi"></div>
</body>
</html>
开通尝试