我的跟随功能在我的控制器中完美运行。但是当它添加到指令时它起作用了,我希望它是选定的剂量在指令中起作用。
directive("multiSelectList", function () {
return {
scope: {
datasource: "=",
datasourceSelected: "="
},
template:
"<div class='col-md-12'> \
<div class='button-group'> \
<button type='button' class='btn btn-default btn-block btn-sm dropdown-toggle' data-toggle='dropdown'><span class=''>TurbineNumber</span> <span class='caret'></span></button> \
<ul class='dropdown-menu' style=''> \
<li style='padding-left:10px;' ng-repeat='c in datasource'> \
<label style='font-weight:100;'> \
<input type='checkbox' ng-model='selected[$index]' ng-change='selected[$index] ? datasourceSelected.push(c.Name): datasourceSelected.splice(datasourceSelected.indexOf(c.Name), 1)' /> {{c.Name}} \
</label> \
</li> \
</ul> \
</div> \
</div>"
};
});
答案 0 :(得分:2)
问题必须在指令的声明中,请使用下面的HTML。
<multi-select-list datasource="turbineNumbersDistinct" datasource-selected="output">
</multi-select-list>