inmagik / ionic-modal-select

Modal select for Ionic Framework
https://inmagik.github.io/ionic-modal-select
MIT License
174 stars 70 forks source link

Change default modal template? #91

Closed boubou158 closed 7 years ago

boubou158 commented 7 years ago

Hi,

Is it possible to change the default modal template? I need to change the class of the reset button in the html code but I don't know how to do, there is no options for that.

Thanks a lot and great work by the way ;)

Rémi

aless673 commented 7 years ago

Hi,

You can use the option "search-template" :

<button id="modalButton" modal-select
    options="contacts"
    ng-model="selectedContacts"
    on-select="onChange(newValue, oldValue)"
    search-template="templates/modal-template.html">

Copy/paste the "modal-template.html" (or modal-template-multiple.html) in your template folder. Now you have to load the template in the $templateCache, here's how :

$http.get('templates/modal-template.html').then(function (response) {
    $templateCache.put('templates/modal-template.html', response.data);
});

Be careful, the "templates/modal-template.html" is not related with the real path (except for the $http call), this is only a key to retrieve the cached template.

bianchimro commented 7 years ago

@aless673 thanks for your clarification.

Do you think we need a "search-template-url" option in order to get a template from a path? That would reduce the boilerplate of putting the template into the cache.

I am closing this anyway, if you feel so open a new issue about this.

regards Mauro

aless673 commented 7 years ago

@bianchimro Yes of course we need this