forked from NG-ZORRO/ng-zorro-antd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prefix.ts
executable file
路30 lines (27 loc) 路 965 Bytes
/
prefix.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { Component, ViewEncapsulation } from '@angular/core';
import { MentionOnSearchTypes } from 'ng-zorro-antd/mention';
@Component({
selector: 'nz-demo-mention-prefix',
encapsulation: ViewEncapsulation.None,
template: `
<nz-mention [nzSuggestions]="suggestions" (nzOnSearchChange)="onSearchChange($event)" [nzPrefix]="['#', '@']">
<textarea
rows="1"
placeholder="input @ to mention people, # to mention tag"
nzMentionTrigger
nz-input
[(ngModel)]="inputValue"
></textarea>
</nz-mention>
`
})
export class NzDemoMentionPrefixComponent {
inputValue?: string;
suggestions: string[] = [];
users = ['afc163', 'benjycui', 'yiminghe', 'RaoHai', '涓枃', '銇伝銈撱仈'];
tags = ['1.0', '2.0', '3.0'];
onSearchChange({ value, prefix }: MentionOnSearchTypes): void {
console.log('nzOnSearchChange', value, prefix);
this.suggestions = prefix === '@' ? this.users : this.tags;
}
}