0

I have a code that calls specific components upon clicking links. These components have init functions that checks certain field values. I'd like to know how many times an init function is called since I wanted it to always perform everytime the component is called.

I added an alert inside the init function of a component and while it is true that it alerts everytime the page is loaded as it is the default component to be loaded, once I click a link and another component loads, then click a new link to load the previous one, the init function does not execute and the alert is gone. I know we have the renderer to fix this kind of stuffs but I wanted to know if we could do it in the init function.

  • This is an X-Y problem. You're trying to fix something else, and believe that "init" is the proper way to handle it, but it's not. Try asking your original question so that we may better assist you. – sfdcfox Aug 7 '17 at 11:13
0

No you can't do that init.

Init is called only when component is initiated/loaded. Second time when you click on the link then behind the scene the component is not loaded it is cached already in the first call that's the reason second time init is not called.

This is the designed behavior of framework.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.