-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(alert): added isOpen input and marked as OnPush (#2940)
* feat(alert): added isOpen input and marked as OnPush * fix(alerts-test): fixed alert component test and few style issues * demo(alert): add dissmissible toggle and dynamic content demo
- Loading branch information
Showing
13 changed files
with
89 additions
and
30 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<div *ngFor="let alert of alerts"> | ||
<alert [type]="alert.type" [dismissible]="true">{{ alert.msg }}</alert> | ||
<alert [type]="alert.type" [dismissible]="dismissible">{{ alert.msg }}</alert> | ||
</div> | ||
<button type="button" class="btn btn-primary" (click)="dismissible = !dismissible">Toggle dismissible</button> | ||
<button type="button" class="btn btn-primary" (click)="reset()">Reset</button> |
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
8 changes: 8 additions & 0 deletions
8
demo/src/app/components/+alerts/demos/dynamic-content/dynamic-content.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,8 @@ | ||
<alert type="success">{{messages[index]}}</alert> | ||
|
||
<div *ngIf="index !== messages.length -1; else elseBlock"> | ||
<button class="btn btn-primary" (click)="changeText()">Change text</button> | ||
</div> | ||
<ng-template #elseBlock> | ||
<button class="btn btn-primary" (click)="index = 0">Reset</button> | ||
</ng-template> |
20 changes: 20 additions & 0 deletions
20
demo/src/app/components/+alerts/demos/dynamic-content/dynamic-content.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,20 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'demo-alert-content-html', | ||
templateUrl: './dynamic-content.html' | ||
}) | ||
export class DemoAlertDynamicContentComponent { | ||
index = 0; | ||
messages = [ | ||
'You successfully read this important alert message.', | ||
'Now this text is different from what it was before. Go ahead and click the button one more time', | ||
'Well done! Click reset button and you\'ll see the first message' | ||
]; | ||
|
||
changeText() { | ||
if (this.messages.length - 1 !== this.index) { | ||
this.index++; | ||
} | ||
} | ||
} |
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
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