-
Notifications
You must be signed in to change notification settings - Fork 915
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #282
- Loading branch information
Showing
10 changed files
with
430 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,19 +7,8 @@ import { Component, ChangeDetectionStrategy } from '@angular/core'; | |
<p> | ||
ng-select supports grouping flat array of objects by providing <b>groupBy</b> input | ||
</p> | ||
---js | ||
const data = [{ name: 'Adam', email: '[email protected]', age: 12, country: 'United States' }, | ||
{ name: 'Samantha', email: '[email protected]', age: 30, country: 'United States' }, | ||
{ name: 'Amalie', email: '[email protected]', age: 12, country: 'Argentina' }, | ||
{ name: 'Estefanía', email: '[email protected]', age: 21, country: 'Argentina' }, | ||
{ name: 'Adrian', email: '[email protected]', age: 21, country: 'Ecuador' }, | ||
{ name: 'Wladimir', email: '[email protected]', age: 30, country: 'Ecuador' }, | ||
{ name: 'Natasha', email: '[email protected]', age: 54, country: 'Ecuador' }, | ||
{ name: 'Nicole', email: '[email protected]', age: 43, country: 'Colombia' }, | ||
{ name: 'Michael', email: '[email protected]', age: 15, country: 'Colombia' }, | ||
{ name: 'Nicolás', email: '[email protected]', age: 43, country: 'Colombia' }]; | ||
--- | ||
<label>Default</label> | ||
---html,true | ||
<ng-select [items]="accounts" | ||
bindLabel="name" | ||
|
@@ -32,6 +21,20 @@ import { Component, ChangeDetectionStrategy } from '@angular/core'; | |
<p> | ||
<small>Selected: {{selectedAccount | json}}</small> | ||
</p> | ||
<hr /> | ||
<label>With selectable groups</label> | ||
---html,true | ||
<ng-select [items]="accounts2" | ||
bindLabel="name" | ||
groupBy="country" | ||
[selectableGroup]="true" | ||
[(ngModel)]="selectedAccount2"> | ||
</ng-select> | ||
--- | ||
<p> | ||
<small>Selected: {{selectedAccount2 | json}}</small> | ||
</p> | ||
` | ||
}) | ||
export class SelectGroupsComponent { | ||
|
@@ -49,6 +52,9 @@ export class SelectGroupsComponent { | |
{ name: 'Nicolás', email: '[email protected]', age: 43, country: 'Colombia' } | ||
]; | ||
|
||
accounts2 = this.accounts.slice(); | ||
selectedAccount2 = this.accounts2[1]; | ||
|
||
ngOnInit() { | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.