-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(button group): add valueChange output (#2722)
- Loading branch information
1 parent
74096d0
commit 39c610c
Showing
8 changed files
with
141 additions
and
9 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
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
28 changes: 28 additions & 0 deletions
28
src/playground/with-layout/button-group/button-group-value-change.component.html
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,28 @@ | ||
<nb-card> | ||
<nb-card-body> | ||
<p> | ||
Group with single select value: {{ singleSelectGroupValue | json }} | ||
</p> | ||
|
||
<nb-button-group (valueChange)="updateSingleSelectGroupValue($event)"> | ||
<button nbButtonToggle value="One">One</button> | ||
<button nbButtonToggle value="Two">Two</button> | ||
<button nbButtonToggle value="Three">Three</button> | ||
</nb-button-group> | ||
</nb-card-body> | ||
</nb-card> | ||
|
||
<nb-card> | ||
<nb-card-body> | ||
<p> | ||
Group with single select value: {{ multiSelectGroupValue | json }} | ||
</p> | ||
|
||
<nb-button-group multiple (valueChange)="updateMultiSelectGroupValue($event)"> | ||
<button nbButtonToggle value="One">One</button> | ||
<button nbButtonToggle value="Two">Two</button> | ||
<button nbButtonToggle value="Three">Three</button> | ||
</nb-button-group> | ||
</nb-card-body> | ||
</nb-card> | ||
|
23 changes: 23 additions & 0 deletions
23
src/playground/with-layout/button-group/button-group-value-change.component.ts
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,23 @@ | ||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component } from '@angular/core'; | ||
|
||
@Component({ | ||
templateUrl: './button-group-value-change.component.html', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class ButtonGroupValueChangeComponent { | ||
singleSelectGroupValue = []; | ||
multiSelectGroupValue = []; | ||
|
||
constructor(private cd: ChangeDetectorRef) { | ||
} | ||
|
||
updateSingleSelectGroupValue(value): void { | ||
this.singleSelectGroupValue = value; | ||
this.cd.markForCheck(); | ||
} | ||
|
||
updateMultiSelectGroupValue(value): void { | ||
this.multiSelectGroupValue = value; | ||
this.cd.markForCheck(); | ||
} | ||
} |
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