techwestcoastsfosea
techwestcoastsfosea

Reputation: 778

Ionic and Allmighty Autocomplete

Has anyone been successfully able to use the Allmighty Autocomplete in their ionic app?

https://github.com/JustGoscha/allmighty-autocomplete

Below is the use case I am trying to solve for:

I have a form where I am asking the user to select their country and then based on that the cities selection will be offered. Since there are 195 countries, the Select option is not a very realistic option. I have looked at the several autocomplete solutions for ionic as well as angularjs. Most of them have a search box with filter set up. This also includes https://github.com/guylabs/ion-autocomplete

Allmighty Autocomplete is the closet one i came to but it doesn't work. I see {{attrs.placeholder}} but when i start typing it doesn't do anything.

Upvotes: 0

Views: 356

Answers (2)

djose90
djose90

Reputation: 719

You can try with this

  1. Install bower: npm install -g bower
  2. Then, run this on the project root: bower install ionic-autocomplete
  3. Add this attribute on the view <input type="text" ng-model="search" ionic-autocomplet="{item:myItems, onSelect: doSomthing}" />
  4. And finally, add this to your controller:
.controller('MyCtrl', function($scope){
   $scope.doSomthing = function(item) {
      console.log('The selected item is: '+item);
   }
 });

Reference : Bower library

Example : Github

I hope this helps

Upvotes: 2

techwestcoastsfosea
techwestcoastsfosea

Reputation: 778

The github example source code has a factory that needed to be loaded.

Upvotes: 0

Related Questions