angularjs bootstrap popover数据绑定(bind)不起作用

标签 angularjs

目前,我正在尝试使 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/

相关文章:

AngularJS 1.2,angular-ui 0.6 模式未显示

javascript - 你如何处理 AngularJS 指令中的异步数据

javascript - 使用 ng-repeat 在指令中显示数据

angularjs - 如何使用带有 Angular 依赖注入(inject)的 typescript 继承

angularjs - 如何使用 ionic Angular 移动应用程序缓存图像?

AngularJS 从指令访问别名 Controller 属性

css - Angular JS 选项卡 CSS

javascript - 我如何将 AngularJs 与 JsBarcode 一起使用?

javascript - 如何防止 ng-repeat 中出现重复的 Angular 键?

javascript - Angularjs 服务单元测试