1

I have this scenario where I am doing translations using toggle button on different modules. The Problem is the code for toggle is written in app.component.ts and I however tried to get the language value in child components but the functionality is only working on page refresh and not on standalone.

Meaning, when i come to home page and switch toggle from En to Fr, it doesnot work but when i goto another link in navigation, the translation works. In short, i need to refresh my child component UI whenever user changes the toggle in parent component.

6
  • I think the same scenario is requested into this question, please feel free to check if this fit in your requirements. stackoverflow.com/questions/40256891/… Commented Aug 27, 2018 at 21:23
  • I have this scenario where child component is not loaded/refreshed again when a change happens in parent component. Means I am on a child component view and do an event on a the page header(which is part of parent component), here no constructor of child component is getting invoked .How can we use changeDetection strategy for such a child component. Commented Aug 28, 2018 at 13:57
  • How you notify your child component events or subscribe? Commented Aug 29, 2018 at 20:08
  • I am subscribing using subject and observables like mentioned in :jasonwatmore.com/post/2016/12/01/…. I am able to listen to the event from app but I need to invoke a service call from the listening component and re-populate my dropdowns once theres is an event from app(like hitting a togglebar). Right now the communication is happening but I don't know how to subscribe to service calls and refresh the dropdown in listening component on the click of event. Commented Aug 30, 2018 at 18:43
  • Both these components have their own modules. But app component is the primary one since its loading the other components in application using router-link. Commented Aug 30, 2018 at 19:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.