Skip to content

Commit 43a00b6

Browse files
author
Guy Brand
committed
(feat): upgrade to Ionic 1.1.0 and Angular 1.4.3
1 parent 9a74e4e commit 43a00b6

19 files changed

+836
-742
lines changed

README.md

+17-22
Original file line numberDiff line numberDiff line change
@@ -84,24 +84,19 @@ ion-autocomplete version | Ionic version
8484
------------------------ | -------------
8585
0.0.2 - 0.1.2 | 1.0.0-beta.14
8686
0.2.0 - 0.2.1 | 1.0.0-rc.3
87-
0.2.2 - latest | 1.0.0
87+
0.2.2 - 0.2.3 | 1.0.0
88+
0.3.0 - latest | 1.1.0
8889

8990
# Usage
9091

9192
To use the `ion-autocomplete` directive in single select mode you need to add the following snippet to your template:
9293
```html
93-
// usage with the element restriction
94-
<ion-autocomplete ng-model="model" />
95-
9694
//usage with the attribute restriction
9795
<input ion-autocomplete type="text" readonly="readonly" class="ion-autocomplete" autocomplete="off" />
9896
```
9997

10098
If you want to use it in multiple select mode you need to add the following snippet to your template:
10199
```html
102-
// usage with the element restriction
103-
<ion-autocomplete ng-model="model" multiple-select="true" />
104-
105100
//usage with the attribute restriction
106101
<input ion-autocomplete type="text" readonly="readonly" class="ion-autocomplete" autocomplete="off" multiple-select="true" />
107102
```
@@ -125,7 +120,7 @@ $scope.callbackMethod = function (query) {
125120

126121
And set the items method on the directive:
127122
```html
128-
<ion-autocomplete ng-model="model" items-method="callbackMethod(query)" />
123+
<input ion-autocomplete type="text" readonly="readonly" class="ion-autocomplete" autocomplete="off" ng-model="model" items-method="callbackMethod(query)" />
129124
```
130125

131126
You are also able to return a promise from this callback method. For example:
@@ -184,7 +179,7 @@ The items method returns the following object:
184179

185180
And now you set the following `item-value-key`:
186181
```html
187-
<ion-autocomplete ng-model="model" item-value-key="id" />
182+
<input ion-autocomplete type="text" readonly="readonly" class="ion-autocomplete" autocomplete="off" ng-model="model" item-value-key="id" />
188183
```
189184

190185
Now when the user selects the `Item 1` from the list, then the value of the objects `id` is stored in the `ng-model`. If
@@ -209,7 +204,7 @@ The `items-method` returns the following object:
209204

210205
And now you set the following `item-view-value-key`:
211206
```html
212-
<ion-autocomplete ng-model="model" item-view-value-key="name" />
207+
<input ion-autocomplete type="text" readonly="readonly" class="ion-autocomplete" autocomplete="off" ng-model="model" item-view-value-key="name" />
213208
```
214209

215210
Now when the user selects the `Item 1` from the list, then the value of the objects `name` is showed in both input fields. If
@@ -219,7 +214,7 @@ no `item-view-value-key` is passed into the directive, the whole item object wil
219214

220215
You are able to set the `multiple-select` attribute to `true` to enable the multiple select feature. Here an example:
221216
```html
222-
<ion-autocomplete ng-model="model" multiple-select="true" />
217+
<input ion-autocomplete type="text" readonly="readonly" class="ion-autocomplete" autocomplete="off" ng-model="model" multiple-select="true" />
223218
```
224219

225220
Then the user is able to select multiple items out of the returned items and also delete them again. The given `ng-model` is an
@@ -246,7 +241,7 @@ $scope.clickedMethod = function (callback) {
246241

247242
And pass in the callback method in the directive:
248243
```html
249-
<ion-autocomplete ng-model="model" items-clicked-method="clickedMethod(callback)" />
244+
<input ion-autocomplete type="text" readonly="readonly" class="ion-autocomplete" autocomplete="off" ng-model="model" items-clicked-method="clickedMethod(callback)" />
250245
```
251246

252247
Then you get a callback object with the clicked/selected item and the selected items if you have multiple selected items (see [The `multiple-select`](#the-multiple-select)).
@@ -274,7 +269,7 @@ $scope.removedMethod = function (callback) {
274269

275270
And pass in the callback method in the directive:
276271
```html
277-
<ion-autocomplete ng-model="model" items-removed-method="removedMethod(callback)" />
272+
<input ion-autocomplete type="text" readonly="readonly" class="ion-autocomplete" autocomplete="off" ng-model="model" items-removed-method="removedMethod(callback)" />
278273
```
279274

280275
Then you get a callback object with the removed item and the selected items if you have multiple selected items (see [The `multiple-select`](#the-multiple-select)).
@@ -299,7 +294,7 @@ $scope.modelToItemMethod = function (modelValue) {
299294

300295
And set the `model-to-item-method` on the directive:
301296
```html
302-
<ion-autocomplete ng-model="model" model-to-item-method="modelToItemMethod(modelValue)" />
297+
<input ion-autocomplete type="text" readonly="readonly" class="ion-autocomplete" autocomplete="off" ng-model="model" model-to-item-method="modelToItemMethod(modelValue)" />
303298
```
304299

305300
You are also able to return a promise from this callback method. For example:
@@ -317,7 +312,7 @@ The component id is an attribute on the `ion-autocomplete` component which sets
317312
the callback object of the [`items-clicked-method`](#the-items-clicked-method) and as a second parameter of the [`items-method`](#the-items-method).
318313
Here an example:
319314
```html
320-
<ion-autocomplete ng-model="model" component-id="component1" />`
315+
<input ion-autocomplete type="text" readonly="readonly" class="ion-autocomplete" autocomplete="off" ng-model="model" component-id="component1" />`
321316
```
322317

323318
You are able to set this is on each component if you have multiple components built up in a ng-repeat where you do not want to have multiple `items-method`
@@ -329,35 +324,35 @@ need to define one callback method and you can distinguish the calls with the `c
329324
You are also able to set the placeholder on the input field and on the search input field if you add the `placeholder`
330325
attribute to the directive:
331326
```html
332-
<ion-autocomplete ng-model="model" placeholder="Enter the query to search for ..." />`
327+
<input ion-autocomplete type="text" readonly="readonly" class="ion-autocomplete" autocomplete="off" ng-model="model" placeholder="Enter the query to search for ..." />`
333328
```
334329

335330
### Cancel button label
336331

337332
You are also able to set the cancel button label (defaults to `Cancel`) if you add the `cancel-label` attribute to the directive:
338333
```html
339-
<ion-autocomplete ng-model="model" cancel-label="Go back" />`
334+
<input ion-autocomplete type="text" readonly="readonly" class="ion-autocomplete" autocomplete="off" ng-model="model" cancel-label="Go back" />`
340335
```
341336

342337
### Select items label
343338

344339
You are also able to set the select items label (defaults to `Select an item...`) if you add the `select-items-label` attribute to the directive:
345340
```html
346-
<ion-autocomplete ng-model="model" select-items-label="Select your items..." />`
341+
<input ion-autocomplete type="text" readonly="readonly" class="ion-autocomplete" autocomplete="off" ng-model="model" select-items-label="Select your items..." />`
347342
```
348343

349344
### Selected items label
350345

351346
You are also able to set the selected items label (defaults to `Selected items:`) if you add the `selected-items-label` attribute to the directive:
352347
```html
353-
<ion-autocomplete ng-model="model" selected-items-label="Selected:" />`
348+
<input ion-autocomplete type="text" readonly="readonly" class="ion-autocomplete" autocomplete="off" ng-model="model" selected-items-label="Selected:" />`
354349
```
355350

356351
### Template url
357352

358353
You are also able to set an own template for the autocomplete component (defaults to `''`) if you add the `template-url` attribute to the directive:
359354
```html
360-
<ion-autocomplete ng-model="model" template-url="templates/template.html" />`
355+
<input ion-autocomplete type="text" readonly="readonly" class="ion-autocomplete" autocomplete="off" ng-model="model" template-url="templates/template.html" />`
361356
```
362357

363358
This way you are able to override the default template (the `searchContainerTemplate` variable [here](https://github.com/guylabs/ion-autocomplete/blob/master/src/ion-autocomplete.js#L75))
@@ -389,7 +384,7 @@ $scope.templateData = {
389384
```
390385
And now you just need to add the `templateData` attribute on the directive:
391386
```html
392-
<ion-autocomplete ng-model="model" template-data="templateData" />`
387+
<input ion-autocomplete type="text" readonly="readonly" class="ion-autocomplete" autocomplete="off" ng-model="model" template-data="templateData" />`
393388
```
394389

395390
Then the expression in your template gets resolved properly.
@@ -423,7 +418,7 @@ This would be the JSON model returned by the `items-method` and in the next snip
423418
name attribute of the child object:
424419

425420
```html
426-
<ion-autocomplete ng-model="model" item-view-value-key="child.name" />
421+
<input ion-autocomplete type="text" readonly="readonly" class="ion-autocomplete" autocomplete="off" ng-model="model" item-view-value-key="child.name" />
427422
```
428423

429424
# Release notes

RELEASENOTES.md

+18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Release notes of ion-autocomplete
22

3+
## Version 0.3.0
4+
5+
* Tag: [0.3.0](https://github.com/guylabs/ion-autocomplete/tree/v0.3.0)
6+
* Release: [ion-autocomplete-0.3.0.zip](https://github.com/guylabs/ion-autocomplete/archive/v0.3.0.zip)
7+
8+
### Changes
9+
10+
* Upgraded to Ionic 1.1.0 and Angular 1.4.3.
11+
* Fixed an issue with multiple `ion-autocomplete` directives on one page.
12+
* Prepared for Angular 2.0.
13+
* Upgraded project to use newest libraries.
14+
15+
### Migration notes
16+
17+
* As of version 0.3.0 the component does not support the element restriction anymore, such that you are just able to
18+
use the attribute restriction on all your elements. This means that you need to convert all `<ion-autocomplete ... />`
19+
tags to the following tag: `<input ion-autocomplete type="text" readonly="readonly" class="ion-autocomplete" autocomplete="off" ... />`
20+
321
## Version 0.2.3
422

523
* Tag: [0.2.3](https://github.com/guylabs/ion-autocomplete/tree/v0.2.3)

bower.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ion-autocomplete",
3-
"version": "0.2.3",
3+
"version": "0.3.0",
44
"description": "A configurable Ionic directive for an autocomplete dropdown",
55
"main": [
66
"./dist/ion-autocomplete.js",
@@ -37,7 +37,7 @@
3737
"url": "https://github.com/guylabs/ion-autocomplete.git"
3838
},
3939
"devDependencies": {
40-
"ionic": "driftyco/ionic-bower#1.0.0",
41-
"angular-mocks": "1.3.13"
40+
"ionic": "driftyco/ionic-bower#1.1.0",
41+
"angular-mocks": "1.4.3"
4242
}
4343
}

0 commit comments

Comments
 (0)