angular的directive指令定义全局公共模板标签用法
项目中,可以通过angular的directive指令用法来实现全局的公共模板标签,实例如下:
<!DOCTYPE html>
<html lang="zh" ng-app="myApp">
<head>
<meta charset="UTF-8">
<title>AngularJS的Directive指令学习</title>
<script type="text/javascript" src="./1.5.3/angular.min.js"></script>
</head>
<body>
<hello-world></hello-world>
</body>
<script type="text/javascript">
var app = angular.module('myApp', []);
app.directive('helloWorld', function() {
return {
restrict: 'E',
template: '<div>Hi 我是小Bye~~~</div>',
replace: true
};
});
</script>
</html>
正在加载评论...