sebaferreras / Ionic3-MultiLevelSideMenu

Ionic 3 demo of a two-level side menu.
MIT License
136 stars 55 forks source link

Support @ngx-translate for displayText #36

Open hkvstore opened 6 years ago

hkvstore commented 6 years ago

I'd like to suggest changing displayText from string to BehaviorSubject\<string> to support dynamic change of display text and @ngx-translate, the HTML markup will become like, e.g.

<span *ngIf="option.displayText | async as menuText">{{ menuText | translate }}</span>
sebaferreras commented 6 years ago

Thanks @hkvstore for your suggestion! 😄

I agree, @ngx-translate support must be added to the component, but using the translate pipe in the view will force everyone to install it so it may not be the better way to add support for translations.

I'm thinking in creating a custom pipe, that could use the injector to check if the TranslateService is available, an if it is available, then use it to get the translation. What do you think @hkvstore ?

hkvstore commented 6 years ago

Yes, that will be even better. Thanks. I however still hope that displayText can be changed dynamically even if TranslateService is not available.