1
私は、angle2アプリケーションのコンポーネントの通信サービスとして件名のサービスを使用しています。2つのパラメータでsubject(rx.js)を作成する方法は?
呼び出す方法:
this.notification.create('test');
サービス:
export class NotificationService {
private static notificationSource = new Subject<any>()
notiCreated$ = NotificationService.notificationSource.asObservable();
create(message) {
NotificationService.notificationSource.next(message);
}
}
と呼ばれる関数:
this.subscription = notification.notiCreated$.subscribe(
data => {
console.log(data);
this.createNotification(data, 'warning');
});
しかし、私は2つのparamsを通過したいです。そして私には誤りがある。
どうすればいいですか?
を行うことは、それは不可能ですがそれは2つのパラメータで? –
@MaxKarpovetsいいえ、 'next'のAPIは' next(value:T):void; 'であるため、1つのパラメータしか必要としません。 – echonax
本当に助けてくれます。ありがとう –