placeholder : The search input placeholder
filter : The filter declared in the ng-repeat (like : | filter:search.value)
class : Classes to add to the main container of the directive
min-length : The minimum length the user has to type before the directive trigger the āsourceā function
model : The model from the parentās scope controller
source : The function which return the promise
Several things :
For the promises, the function parameter has to be named āstrā
For the preloaded data, the search filter has to be named āsearch.valueā
For the promises demo, I use Web SQL, so this demo works only on safari / chrome, but it also works with the SQLite Cordova plugin.
Iāve included some other tiny features like my DB factory which is a wrapper around the Web SQL API using promises.
If anyone want improve this, Iāll be grateful, itās my first directive ever !
Enjoy.
I would integrate ionSearch with bindonce directive to disable unusable watchers that very effect on search performance. In chrome it works fine but on phones with 320 accounts the typing is slow.
Your search diective works fine wth WEBSQL but encnter issues with SQLiteā¦
I tried to implement the SqlitePlugin instead of the web sql in your example.
Unfortunately I have an issue : SQLitePlugin.js: Line 56 : Uncaught TypeError: Object # has no method āexecā
Did you encounter this behavior ?
I just added the Sqlite Cordova plugin and the JS file associated.
As the Sqlite plugin and the WebSQL share the same API, I think it could be a plugin import error or maybe your device is not ready when you try to execute some queries. (You have to put the database initialization and the first queries loaded inside a $ionicPlatform.ready(function() {}); block).
Did you install the plugin and add the cordova.js in your index ?
If itās working with WebSQL, it should works the same way with the SQLite plugin.
OK I applied the ionicplatform.reay in the RUN, itās working for the Preloaded tab but I donāt have any tools to check the database on my phoneā¦
The Sqlite plugin was installed with : cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git
And I still have this issue : D/CordovaLog( 5858): file:///android_asset/www/js/SQLitePlugin.js: Line 56 : Uncaught TypeError: Object # has no method āexecā
The system detects properly the Sqlite I added a console.log to see it.
Hello, I cannot access the codepen anymore. I would be very thankful if you could make your codepen available, again. Thank you in advance and thumbs up for the good work!
I would like that after I click on one item in the list, the input field takes that value. So I created an ng-click event to call the following function:
First of all, thank you for your reply. I did that, but forgot to mention it. Strangely that doesnt work.
If I add a second field without the directive but bound to the search.value-model this new field updates as expected. But not the auto-complete-field.