Multiselect for Inonic Framework. Inspired by ionic-fancy-select and this snippet: http://codepen.io/mhartington/pen/CImqy?editors=101.
Via bower:
bower install ionic-multiselect
Add script js:
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js"></script> <script src="bower_components/ionic-multiselect/dist/ionic-multiselect.min.js"></script>
Add the module ionic-multiselect to module main:
var App = angular.module("MainApp", ["ionic-multiselect"]);
Configure module:
App.config(function(multiselectProvider) { multiselectProvider.setTemplateUrl('bower_components/ionic-multiselect/dist/templates/item-template.html'); multiselectProvider.setModalTemplateUrl('bower_components/ionic-multiselect/dist/templates/modal-template.html'); });
Add to html this line:
<multiselect items="data" text-property="value" value-property="id" text="Text default multiselect" </multiselect> #or <multiselect header-text="Header" items="data" text-property="value" value-property="id" checked-property="selected" is-translate="true" index-translate="TAG_TRANSLATE" text="Text default multiselect" modal-template-url="bower_components/ionic-multiselect/templates/modal-template.html" template-url="bower_components/ionic-multiselect/templates/item-template.html" note-text="Note Text" value-changed="onValueChanged(value)"> </multiselect>
Get value selected:
//Your controller $scope.onValueChanged = function(value){ //Value return a array objects with items selected console.log(value); }
header-text
Type: String Used to specify the text that is shown in the Modal's header bar.
Items
Type: Array A list of items that is bound to the select.
3- text-property
Type: String Property description of item the array.
value-property
Type: String Property id of item the array.
Is-Translate
type: Boolean If used angular translate for item text.
Index-translate
type: String If used angular-translate this is the tag for indicate el tag main for items. For example, if we need to show the categories used the tag 'CATEGORY_' and ionic-multiselect automatically search the following internally in the ng-repeat 'CATEGORY_1' 'CATEGORY_2', etc. Internally uses the value-property field.
text
Type: String Value default multiselect.
modal-template-url
Type: URL An optional URL that can be used to customise the look and feel of the Modal
template-url
Type: URL An optional URL that can be used to custome the look and feel of fancy-select element.
note-text
Type: String An optional note that can be displayed in the default multiselect element.
value-changed (Callback)
Parameters: value - The currently selected value or list of values Raised when the current value changes.
Check the file index.