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)' />&nbsp;{{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> 

jsfiddle demo


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -