-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(module:notification): display
nzData
when content is a template (
- Loading branch information
Showing
16 changed files
with
197 additions
and
67 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
order: 5 | ||
title: | ||
zh-CN: 自定义模板 | ||
en-US: Custom Template | ||
--- | ||
|
||
## zh-CN | ||
|
||
您可以为消息内容创建自定义模板。 | ||
通过 `nzData` 选项,您可以传递一些可选的数据给此自定义模板。 | ||
|
||
## en-US | ||
|
||
You can have a custom template for the message content. | ||
You would have the possibility to pass some optional data to this custom template thanks to the `nzData` option |
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,25 @@ | ||
import { Component, TemplateRef, ViewChild } from '@angular/core'; | ||
|
||
import { NzButtonModule } from 'ng-zorro-antd/button'; | ||
import { NzMessageComponent, NzMessageService } from 'ng-zorro-antd/message'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-message-template', | ||
imports: [NzButtonModule], | ||
template: ` | ||
<button nz-button nzType="default" (click)="showMessage()">Display a custom template</button> | ||
<ng-template #customTemplate let-data="data">My Favorite Framework is {{ data }}</ng-template> | ||
` | ||
}) | ||
export class NzDemoMessageTemplateComponent { | ||
@ViewChild('customTemplate', { static: true }) customTemplate!: TemplateRef<{ | ||
$implicit: NzMessageComponent; | ||
data: string; | ||
}>; | ||
|
||
constructor(private message: NzMessageService) {} | ||
|
||
showMessage(): void { | ||
this.message.success(this.customTemplate, { nzData: 'Angular' }); | ||
} | ||
} |
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
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.