Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: structural directive could get nested property #41

Closed
fxck opened this issue Aug 27, 2019 · 1 comment
Closed

feature: structural directive could get nested property #41

fxck opened this issue Aug 27, 2019 · 1 comment
Assignees
Labels

Comments

@fxck
Copy link
Contributor

fxck commented Aug 27, 2019

Given this translation file

{
  dashboard: {
    projectsTitle: 'Projects',
    projectsDesc: 'Lorem ipsum.'
  }
}

when you do this:

<ng-container *transloco="let t">

</ng-container>

..using shared strategy you get the whole object.

So you have to do {{ t.dashboard.projectsTitle }} and {{ t.dashboard.projectsDesc }} etc., it would be nice if you could do something like this

<ng-container *transloco="let t; read: 'dashboard'">
  <h1>{{ t.projectsTitle }}</h1>
  <p>{{ t.projectsDesc }}</p>
</ng-container>

..if it were only "dashboard" it wouldn't be that bad, but in my case it's @zerops/zerops/pages/dashboard (unique id of the lazy loaded module, used for various other things, ngrx state etc.), so

<ng-container *transloco="let t; read: featureKey;">
  <h1>{{ t.projectsTitle }}</h1>
  <p>{{ t.projectsDesc }}</p>
</ng-container>

would be much nicer than

<ng-container *transloco="let t; read: featureKey;">
  <h1>{{ t[featureKey].projectsTitle }}</h1>
  <p>{{ t[featureKey].projectsDesc }}</p>
</ng-container>
@NetanelBasal
Copy link
Contributor

That's nice, but it will limit you to use only keys from this specific scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants