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

Is there a built in way to conditional render applications? #134

Open
billyjov opened this issue May 25, 2021 · 1 comment
Open

Is there a built in way to conditional render applications? #134

billyjov opened this issue May 25, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@billyjov
Copy link

Is it possible to add condition to template ? Something like *ngIf in Angular ?

@joeldenning
Copy link
Member

No, this isn't yet supported in the layout definition. You can do it in a somewhat roundabout way like this:

function applicationDisabled = (appName) => {
  const disabledApps = ['settings']
  return disabledApps.includes(appName)
}

constructApplications({
  routes,
  loadApp(app) {
    if (applicationDisabled(app.name)) {
      throw Error('application disabled')
    } else {
      return System.import(app.name)
    }
  }
})

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

No branches or pull requests

3 participants