States in Angular2+

Asked

Viewed 17 times

-2

I am having doubts about how to modify a state at the angle. I am using Zorro filterSelect, so I have to modify this.filterEquipe to disable or enable the field

export class MainDashboardComponent implements OnInit {

  filterEquipe = true;
  new FieldSelect(
      'id_supervisor',
      'Supervisor',
      'Supervisor',
      this.filterEquipe /*&& this.permissions.supervisorFilter*/ ,
      'md-4', []
    )
    .smartOptions(this.queryService, 'employers', name => {
      return {
        filter: {
          name,
          occupation: 'supervisor',
        },
        order: 'name',
      };
    })
    .setProperties('name', 'employee_id')
    .changes((value, model, formControl, form, field) => {
      this.supervisorId = value;
      console.log(this.supervisorId);

      const gestor = form.controls.id_gestor;
      const equipe = form.controls.id_equipe;

      const gestorTemplateOptions = field.templateOptions as any;
      const equipeTemplateOptions = field.templateOptions as any;

      if (gestor) {
        gestor.setValue(null);
        console.log('limpando Gestor');
      }
      if (equipe) {
        console.log('limpando equipe');
        equipe.setValue(null);
      }

      setTimeout(() => {
        return equipeTemplateOptions.update('id_equipe');
      });

      setTimeout(() => {
        return gestorTemplateOptions.update('id_gestor');
      });
    })
    .mode('multiple')
    .getModel(),

    changes(value => {
      if (value) {
        console.log(this.filterEquipe);
        return (this.filterEquipe = !this.filterEquipe);
      }
    })
}
<div class="flex-column space-between" [hidden]="!funnel">
  <div class="flex-column">
    <div>
      <brisanet-core-form [fields]="generalFilterFields" [model]="generalFilterModel" [form]="generalFilterForm">
      </brisanet-core-form>
    </div>
  </div>

I want to go back inside this filterEquipe a state after modification of an Input, but it is not changing that initial state

  • You could give more details of what you want and the problem that is occurring, if possible add tbm to html concerning the problem!

  • edited and added html

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.