<html ng-app="compile">

    <head>
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>
<div ng-controller="compileCtrl">
<ts-s> </ts-s>
</div>
<script type="text/javascript">
var app = angular.module("compile", []);
app.controller("compileCtrl", function($scope){
$scope.updateModuleInfo = function( module ){
console.log("module : " + module);
}
});
app.directive('tsS', function($compile) {
return {
//template:"<input type='text' ng=model='sampleData'/> {{sampleData}} <br/>"
link: function(scope, element, atts, controller) {
var module = {
id : "11",
name : "john"
}
var markup = "<input type='text' ng-model='sampleData' ng-change='updateModuleInfo(module)'/> {{sampleData}} <br/>";
element.html(markup);
scope.module = module;//向scope中插入module对象
$compile(element.contents())(scope);
}
};
}); </script>
</body>
</html>

em:

scope.module = module;//向scope中插入module对象

renderRow : function(nRow, aData, iDataIndex, anHidden){
var link = $compile('<a href="" ng-click="updateModuleInfo(aData)> 编辑 </a>' );
var scope = $scope.$new(false);//新建子作用域
var node = link(scope);
scope.aData = aData;//向scope中插入aData对象
if (true) {
$(--).html(node)
}
}

随机推荐

  1. python3 @classmethod 的使用场合

    官方的说法: classmethod(function)中文说明:classmethod是用来指定一个类的方法为类方法,没有此参数指定的类的方法为实例方法,使用方法如下: class C: @clas ...

  2. Banner中利用Jquery隐藏显示下方DIV块

    实现方式1: <!DOCTYPE html><html><head>    <meta charset="UTF-8">    &l ...

  3. C#面向对象设计模式纵横谈——1.面向对象设计模式与原则

    一:设计模式简介 每一个模式描述了一个在我们周围不断重复发生的问题,以及该问题的解决方案的核心. ---- Christopher Alexander 软件设计领域设计模式: 设计模式描述了软件设计过 ...

  4. 北京培训记day1

    数学什么的....简直是丧心病狂啊好不好 引入:Q1:前n个数中最多能取几个,使得没有一个数是另一个的倍数   答案:(n/2)上取整 p.s.取后n/2个就好了 Q2:在Q1条件下,和最小为多少 答 ...

  5. sass 安装、配置,css规则

    http://blog.csdn.net/oyuemijindu/article/details/51036096 --sass 安装 一安装  1.ruby下载,可以到官网下载 ,注意如果是系统如果 ...

  6. 【JavaWeb】Spring+SpringMVC+MyBatis+SpringSecurity+EhCache+JCaptcha 完整Web基础框架(四)

    SpringSecurity(1) 其实啊,这部分我是最不想写的,因为最麻烦的也是这部分,真的是非常非常的麻烦.关于SpringSecurity的配置,让我折腾了好半天,网上的配置方式一大把,但总有一 ...

  7. HP 820 G2变色龙安装10.11.6基本完美

    初始状态: 一块ssd硬盘,MBR格式分区,安装了WIN7 64位. 不想动win系统,因此就安装在硬盘的扩展分区 电脑配置: cpu: i7-5600u 声卡: ALC280 显卡: HD55 ...

  8. cent6.4使用

    让centos能够上网 刚安装了时,是不能联网的,我们可以通过以下命令更改即可: cd /etc/sysconfig/network-script vi ifcfg-eth0 更改其中的ONBOOT= ...

  9. ROC & AUC笔记

    易懂:http://alexkong.net/2013/06/introduction-to-auc-and-roc/ 分析全面但难懂:http://mlwiki.org/index.php/ROC_ ...

  10. WPF 控件总结

    内容控件:1.Button:当Button.IsCancel="True"时,点击按钮,对话框关闭.当Button.IsDefault="True",按回车触发 ...