I am new to angular 2 and want to know which is the best way to pass data between 2 components when a user switches from one view to another.
more elaborately, I have 2 components: login and home. when a user enters the username in the login form and clicks submit, the username should be submitted to home page component and should be stored locally so that when user refresh the page still shows the username.