Angular 6 NgDoCheck

0

Good evening,

I'm starting to angle myself and came across two issues I wanted to try to clarify with what you realize.

1 - I created an application in which on my main page I have a sidanav, a toolbar and content.

The sidenav and toolbar are components that will be shown if the user is logged in and the content has one where the various components of the application will be passed. Whenever I log in the rendering of sidenav components and toolbar is done successfully with (ngOnInit) but when I logout (in a child component that will be passed by the router-outlet) no, since it does not run the function again and render it from page. I solved using (OnDoCheck), but I noticed that whenever I enter a character (or any other action) it is fired. Is not this too cumbersome for the application?

Is there another way to run a function in the "app.component.ts" always and only if it is logged out, in this case, a child component that will pass in?

2- I tried to use a flag by passing the child variable - > dad.

I used the @output in the child with the EventEmitter but the question is how I get it in the parent. Normally I would, but how am I going to pass these components with the is there any way to pass this value?

I hope to have passed my doubt in a minimally perceptible way.

Thank you in advance, LbrT

    
asked by anonymous 25.10.2018 / 01:01

0 answers