AngularJS指令数据绑定在一个popover中

时间:2016-06-09 01:29:40

标签: angularjs popover directive

您好我正在创建一个Angular bootstrap popover,并且popover包含一个指令。用户故事是当用户点击ui-grid表中的行时,将显示弹出窗口。但似乎在HTML代码中数据实际上并没有传递给指令。相关代码在这里:

search.tpl.html:

<div class="gridStyle" ui-grid="vm.selectedTypes" ui-grid-resize-columns ui-grid-selection style="margin-top: 0px; z-index: 4; position: relative">
</div>

<script type="text/ng-templae" id="popover.html">
    <div style="z-index:10; position: relative">
        <type-view type="vm.type" domain="vm.domain" pos="{top: 0, left: 0}">
        </type-view>
    </div>
</script>

search.js:

//In configure
controllerAs: "vm",
...
//In controller
var vm=this;

vm.type=[...];
vm.domain=[...]; //both var get values inside

现在显示popover,指令在里面,但是值(vm.type和vm.domain)没有注入到指令中;我检查了控制台,并且在指令'pos'中注入了,所以我想也许是因为在popover中范围不同并且直接使用vm.sth将不起作用。我该如何解决这个问题?谢谢!

0 个答案:

没有答案