vendredi 10 juin 2016

How to override an external html template angular.js


I'm using this https://github.com/amitava82/angular-multiselect multiselect dropdown for my project.

In my html:

<am-multiselect class="sv-manage-multiselect-dropdown"
                 ng-model="nameList.name"
                 options="name as name.key for name in nameList"
                 multiple="true"                  
</am-multiselect>

This dropdown has a "checkall" and "uncheckall" button in the dropdown, which I WANT to remove, while keeping the functionality of the multi-select.

This is the html in the directive the guy uses:

src/multiselect.tmpl.html

<div class="btn-group">
    <button type="button" class="btn btn-default dropdown-toggle" ng-click="toggleSelect()" ng-disabled="disabled" ng-class="{'error': !valid()}">
        {{header}}
        <span class="caret"></span>
    </button>
    <ul class="dropdown-menu">
        <li>
            <input class="form-control input-sm" type="text" ng-model="searchText.label" ng-keydown="keydown($event)" autofocus="autofocus" placeholder="Filter" />
        </li>
        <li ng-show="multiple" role="presentation" class="">
            <button class="btn btn-link btn-xs" ng-click="checkAll()" type="button"><i class="glyphicon glyphicon-ok"></i> Check all</button>
            <button class="btn btn-link btn-xs" ng-click="uncheckAll()" type="button"><i class="glyphicon glyphicon-remove"></i> Uncheck all</button>
        </li>
        <li ng-repeat="i in items | filter:searchText" ng-class="{'selected': $index === selectedIndex}">
            <a ng-click="select(i); focus()">
            <i class='glyphicon' ng-class="{'glyphicon-ok': i.checked, 'empty': !i.checked}"></i> {{i.label}}</a>
        </li>
    </ul>
</div>

I wan't to just remove/override the checkall and uncheckall buttons WITHOUT editing this library's directive. I can override the CSS in my personal file.css, but how do I override the HTML template he uses. Thanks

enter image description here


Aucun commentaire:

Enregistrer un commentaire