Created
July 6, 2017 16:56
-
-
Save gokman/86165627c46f79e240c54e485cbb3ee2 to your computer and use it in GitHub Desktop.
rx subject in angular2
This file contains hidden or 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
| 1 First define a Rx Subject object | |
| private subjectObject = new Subject(); | |
| 2 You can publish an event by using next() method | |
| subjectObject.next(item); | |
| 3 when Subject object publish an event it can be listened by using subscribe | |
| subjectObject.subscribe(value => { | |
| console.log(value); | |
| }); | |
| with above code you can catch the published value and can see on the console |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment