1
내 angular2 응용 프로그램의 구성 요소에 대한 통신 서비스로 subject가있는 서비스를 사용하고 있습니다.2 개의 매개 변수로 주제 (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 param 함께? –
@MaxKarpovets 'next'의 API가'next (value : T) : void; '이므로 1 개의 매개 변수 만 필요합니다. – echonax
정말 도움이됩니다. 감사 –