Skip to content

Commit

Permalink
added ability to use ngModel, fixes #5
Browse files Browse the repository at this point in the history
  • Loading branch information
joebrinkman-earnin committed Sep 19, 2016
1 parent bf3c9fc commit 5c2c6f8
Show file tree
Hide file tree
Showing 7 changed files with 725 additions and 566 deletions.
162 changes: 94 additions & 68 deletions .idea/workspace.xml

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
Nothing here yet
<a name="1.0.0"></a>
# [1.0.0](https://github.com/angular/angular/compare/0.5.1...1.0.0) (2016-09-19)


### Bug Fixes

* No suggestions provided when the input is the same ([#4](https://github.com/brinkmanjg/ng2-typeahead/issues/4))
* error in example code (wrong list name) ([#6](https://github.com/brinkmanjg/ng2-typeahead/issues/6))
* adjustments in systemjs.config.js to run example code ([#7](https://github.com/brinkmanjg/ng2-typeahead/issues/7))
* Databinding for existing value ([#5](https://github.com/brinkmanjg/ng2-typeahead/issues/5))

13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ A simple Angular2 typeahead/autocomplete component.

###### my.component.ts
```javascript
import {Typeahead} from 'ng2-typeahead'
import { Typeahead } from 'ng2-typeahead';

@NgModule({
declarations: [ Typeahead ],
})

@Component({
selector: 'my-component',
template: require('./my.component.html'),
directives: [Typeahead]
template: require('./my.component.html')
})
export class MyComponent {

Expand All @@ -51,7 +54,7 @@ export class MyComponent {
}
];

selectedFruit: any;
selectedFruit: any = this.fruits[0];

public fruitSelected(fruit) {
this.selectedFruit = fruit;
Expand All @@ -63,6 +66,7 @@ export class MyComponent {
###### my.component.html
```html
<typeahead
[(ngModel)]="selectedFruit"
[list]="fruits"
[searchProperty]="'searchText'" [displayProperty]="'name'"
[maxSuggestions]="2"
Expand Down Expand Up @@ -99,6 +103,7 @@ This is the only directive. Provide a list of suggestions as an object array, sp

Binding Property | Type | Remarks
------------ | ---------- | -------------
`[(ngModel)]` | `any` | The model property to which the component is bound. Optional.
`[list]` | `any[]` | The complete list of items. These can be any type of object. This is required.
`[displayProperty]` | `string` | The property of a list item that should be displayed. The default is 'name'.
`[searchProperty]` | `string` | The property of a list item that should be used for matching. The default is 'name'.
Expand Down
58 changes: 57 additions & 1 deletion lib/ng2-typeahead.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/ng2-typeahead.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings",
"localdev": "tsc && cp -r lib src ../angular2-webpack-starter/node_modules/ng2-typeahead/"
"localdev": "tsc && cp -r lib src ../dev-site/node_modules/ng2-typeahead/"
},
"keywords": [
"angular",
Expand All @@ -37,6 +37,7 @@
"dependencies": {
"@angular/common": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
Expand Down
Loading

0 comments on commit 5c2c6f8

Please sign in to comment.