Reputation: 727
in my Angular App I have a main component A and a sub component B loaded by lazy loading.
In this sub component B I have the following functions:
translator(){
this.translate.use('de');
}
checkText(){
console.log('check text works!')
}
And, if I call this 2 functions from A by:
this.administrationMainComponent.checkText();
this.administrationMainComponent.translator();
Only the check text works.
1) Sure is not a problem of translator in B itself (if I execute it from the constructor of B, it works perfectly);
2) Sure, is not a problem about Injectable or something similar, because the check text works perfectly if I call it from A
How can I solve the problem and execute correctly translator from A?
EDIT: Also by this way it doesn't work
translator = () => {
console.log('check translator text!');
this.translate.use('de');
}
Upvotes: 0
Views: 507
Reputation: 727
This is the solution: put the translator part of the module in an external shared module and shared the same from it.
Upvotes: 1