目前,我正在尝试使angularjs popover数据绑定工作.
这是html部分:
<div id="sortable" ng-repeat="object in arrayForShow">
<div ng-class="classGenerate(object)" class="well nomargin" id="resizable" pop-over-width-offset argument='object'>
{{object.default}}
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
现在:ng-repeat item:将对象传递给指令pop-over-width-offset.
在popOverWidthOffset指令中: 我正在尝试使模板html能够访问**参数(我在指令的范围中设置).**
app.directive "popOverWidthOffset", ($templateCache)->
restrict: 'A',
controller: 'CustomiseFormCtrl'
scope: {
argument: '='
}
link: (scope, element, attrs)->
popOverContent = $templateCache.get('angular/templates/popOverCustomisationChangeWidthOffset.html')
options = {
content: popOverContent,
placement: "top",
html: true,
}
$(element).popover(options)
Run Code Online (Sandbox Code Playgroud)
popOverCustomisationChangeWidthOffset.html:
<form>
{{argument}}
</form>
Run Code Online (Sandbox Code Playgroud)
编译弹出窗口的内容:
compiledPopOverContent = $compile(popOverContent)(scope);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
963 次 |
| 最近记录: |