send event to child component angular
Parent-Component
eventsSubject: Subject<void> = new Subject<void>();
emitEventToChild() {
this.eventsSubject.next();
}
Parent-HTML
<child [events]="eventsSubject.asObservable()"> </child>
Child-Component
private eventsSubscription: Subscription;
@Input() events: Observable<void>;
ngOnInit(){
this.eventsSubscription = this.events.subscribe(() => doSomething());
}
ngOnDestroy() {
this.eventsSubscription.unsubscribe();
}
Also in JavaScript:
- find prime number function javascript es6
- react router tutorial medium
- how to wait for an exec command to fininsh in nodejs
- jest mock instance
- javascript to array
- angular pipe json error
- close browser tab javascript
- int val javascript
- event listener to elements with class
- hot loading react native shortcut key
- jsonarray find
- add new array at the back of react state
- javascript onclick open url same window
- post request using vue.js github repo
- class combining
- how do I use const in javascript
- use ngfor to make a dropdown in angular from array
- mometjs
- change text shadow javascript
- key code
- deploy create react app pm2
- jquery set checkbox checked
- if isset handlebars js
- javascript array exists check