formly-js / angular-formly

JavaScript powered forms for AngularJS
http://docs.angular-formly.com
MIT License
2.22k stars 405 forks source link

Formly fields not updating the hideExpression attribute on a field when model changes #754

Open kanalasumant opened 6 years ago

kanalasumant commented 6 years ago

I'm sorry to have posted this in here since I tried to go here: help.angular-formly.com but there was no content there or removed.

I have a hide expression as so:

    key: "rotation_speed",
    type: "select",
    noFormControl: true,
    templateOptions: {
      label: 'Animation Speed',
      required: true,
      placeholder: 'Animation Speed',
      valueProp: "value",
      labelProp: "name",
      options: [
        {
          'name' : 'Fast Clockwise',
          'value' : '-10'
        },
        {
          'name' : 'Medium Clockwise',
          'value' : '-5'
        }
      ]
    },
    hideExpression: 'model.img_type === "regular"',
  }

and the formly fields in frontend as this:

<formly-form model="panoFactory.presentation.scenes[$index]" fields="scene_fields"></formly-form>

I verified that the model changes in the frontend but the hideExpression isn't getting updated probably due to some scoping issues. Any help on this would be much appreciated. Thanks!