Reputation: 31
How to save data when I navigate to another route? For example, I have routes as below. I navigate to routerA and input some data. If I navigate to routerB and then navigate back to routeA I won't see the previous data that I input.
const appRoutes: Routes = [
{ path: 'routerA', component: RouterAComponent },
{ path: 'routerB', component: RouterBComponent }
]
Upvotes: 0
Views: 1440
Reputation: 1696
you should use service for store data in variable and access this data through service.
.....
@Injectable()
export class UserService {
public username;
MPIDList: any;
days: any;
uid: String;
BackUrl: any;
activeMPID: String;
LastExecutionDate: String;
....
Upvotes: 1