forked from NG-ZORRO/ng-zorro-antd
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(module:mention): fix cannot to switch trigger (NG-ZORRO#3632)
* fix(module:mention): fix cannot to switch trigger close NG-ZORRO#3629 * test(module:mention): add test * docs(module:mention): fix API
- Loading branch information
Showing
8 changed files
with
112 additions
and
24 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
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,33 @@ | ||
/** | ||
* @license | ||
* Copyright Alibaba.com All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE | ||
*/ | ||
|
||
import { Injectable, OnDestroy } from '@angular/core'; | ||
import { Observable, Subject } from 'rxjs'; | ||
|
||
import { NzMentionTriggerDirective } from './nz-mention-trigger'; | ||
|
||
@Injectable() | ||
export class NzMentionService implements OnDestroy { | ||
private trigger: NzMentionTriggerDirective; | ||
private triggerChange$ = new Subject<NzMentionTriggerDirective>(); | ||
|
||
triggerChanged(): Observable<NzMentionTriggerDirective> { | ||
return this.triggerChange$.asObservable(); | ||
} | ||
|
||
registerTrigger(trigger: NzMentionTriggerDirective): void { | ||
if (this.trigger !== trigger) { | ||
this.trigger = trigger; | ||
this.triggerChange$.next(trigger); | ||
} | ||
} | ||
|
||
ngOnDestroy(): void { | ||
this.triggerChange$.complete(); | ||
} | ||
} |
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