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

Values not populated when using hideExpression #580

Closed
sveatlo opened this issue Dec 1, 2017 · 2 comments · Fixed by #581
Closed

Values not populated when using hideExpression #580

sveatlo opened this issue Dec 1, 2017 · 2 comments · Fixed by #581
Labels

Comments

@sveatlo
Copy link

sveatlo commented Dec 1, 2017

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request

Current behavior

When formModel is loaded asynchronously (eg. editing some data from server) and the form uses hideExpression on some of its fields, values for these fields don't get populated to form.

Expected behavior

Values from the model should be available in the form.

Minimal reproduction of the problem with instructions

https://stackblitz.com/edit/angular-jjhxfl

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • Angular version: 4.3.6 and 5.0.2
  • Browser: all
  • Language: TypeScript 2.4.2

  • Node (for AoT issues): node --version = v9.2.0

@aitboudad
Copy link
Member

neither model nor validation are applied when combining hideExpression with the key, you can achieve your use case using fieldGroup:

    {
      hideExpression: 'model.group_id !== "3"',
      fieldGroup: [
        {
          type: 'input',
          key: 'group.demo_input',
          templateOptions: {
            label: 'Demo input'
          },
        }
      ]
    }

@aitboudad
Copy link
Member

well I think this is bug and the new model value should be taken into account

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

Successfully merging a pull request may close this issue.

2 participants