Angular学习(8)- directive
2024-09-11 14:56:03
<!DOCTYPE html>
<html ng-app="MyApp">
<head>
<title>Study 9</title>
<script type="text/javascript" src="js/angular.js"></script>
</head>
<body>
<div ng-controller="testController">
<hello say="content">Grid</hello>
</div> <script type="text/javascript">
var app = angular.module("MyApp", [], function() { });
app.controller("testController", function($scope) {
$scope.content = "I love you.";
});
app.directive("hello", function() {
return {
restrict: "E",
template: "<div>hello,<b ng-transclude></b>,{{cont}}</div>",
replace: true,
transclude: true,
scope: {
cont: "=say"
}
};
});
</script>
</body>
</html>
示例:
最新文章
- 简单的JavaScript互斥锁
- opcode的执行
- 计算字符串中al_num,spance_num,digit_num,other_num的个数
- LINQ使用
- TortoiseSVN使用详细步骤
- git的使用--不错的博客【转】
- 局域网架个YUM源-HTTP的
- TMS X-Cloud Todolist with FNC
- 分析Cocos2d-x横版ACT手游源 2、server场景
- 再谈CVE-2017-7047 Triple_Fetch和iOS 10.3.2沙盒逃逸
- 关于SCSI/SATA/IDE硬盘的比较
- 18 UI美化状态集合的位图selector
- iOS指纹识别Touch ID的安全性探讨
- Python多线程的简单实现(生产者消费者模型)
- UE4入门(二)建立和打开项目
- swift便利构造函数
- js对数组对象的操作以及方法的使用
- RPDU
- git怎么使用
- Python自动化之高级语法单例模式