目前,我正在尝试使 angularjs 弹出框数据绑定(bind)工作。
这是 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>
现在:ng-repeat item: object 被传递到指令 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)
popOverCustomizationChangeWidthOffset.html:
<form>
{{argument}}
</form>
最佳答案
Compile弹出窗口的内容:
compiledPopOverContent = $compile(popOverContent)(scope);
关于angularjs bootstrap popover数据绑定(bind)不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23710382/