This repository has been archived by the owner on Jun 7, 2022. It is now read-only.
forked from muhammadarsal/ng-select2
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf3f954
commit 457b8fc
Showing
6 changed files
with
53 additions
and
1 deletion.
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
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
Empty file.
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<h2>9. Allow clear</h2> | ||
|
||
<ng-select2 [data]="exampleData" | ||
[placeholder]="'Demo with allow clear'" | ||
[width]="300" | ||
[allowClear]="true" | ||
[dropdownParent]="'test'" | ||
[options]="options"></ng-select2> |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { Select2OptionData } from 'ngSelect2'; | ||
import { Options } from 'select2'; | ||
|
||
@Component({ | ||
selector: 'app-allow-clear', | ||
templateUrl: './allow-clear.component.html', | ||
styleUrls: ['./allow-clear.component.css'] | ||
}) | ||
export class AllowClearComponent implements OnInit { | ||
public exampleData: Array<Select2OptionData>; | ||
public options: Options; | ||
|
||
ngOnInit() { | ||
this.exampleData = [ | ||
{ | ||
id: 'opt1', | ||
text: 'Options 1' | ||
}, | ||
{ | ||
id: 'opt2', | ||
text: 'Options 2' | ||
}, | ||
{ | ||
id: 'opt3', | ||
text: 'Options 3' | ||
}, | ||
{ | ||
id: 'opt4', | ||
text: 'Options 4' | ||
} | ||
]; | ||
|
||
this.options = { | ||
width: '300' | ||
}; | ||
} | ||
} |