angularjs - Using selected in a directive -
i have following works in controller. when adding directive dosent work, , expect selected dosent work in directives.
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>" }; });
the issue must in declaration of directive, please use below html.
<multi-select-list datasource="turbinenumbersdistinct" datasource-selected="output"> </multi-select-list>
Comments
Post a Comment