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

Dynamic Form Extensions for Angular calls Options PropCallback Infinite times #4865

Closed
rsposato06 opened this issue Jul 23, 2020 · 1 comment

Comments

@rsposato06
Copy link

rsposato06 commented Jul 23, 2020

Having issues with generating a drop down on the users screen using Dynamic Form Extensions for Angular. The below code calls my API infinite number of times until I close the Edit or Create Modal window. Copied example from this page: https://docs.abp.io/en/commercial/latest/ui/angular/dynamic-form-extensions#formprop-r-any

import { Validators } from '@angular/forms';
import { ePropType, FormProp, FormPropList } from '@abp/ng.theme.shared/extensions';
import { Identity,IdentityCreateFormPropContributors,
    IdentityEditFormPropContributors } from '@volo/abp.ng.identity';
import { ClientsService } from '../../clients/clients/clients.service';
import { map } from 'rxjs/operators';
import { AbstractClassPart } from '@angular/compiler/src/output/output_ast';

const clientProp = new FormProp<Identity.UserItem>({
  type: ePropType.String,
  name: 'ClientId',
  displayName: 'Client',
  isExtra: true,
  autocomplete: "off",
  defaultValue: "",
  options: data => {
      const service = data.getInjected(ClientsService);

      return service.getAll()
      .pipe(
          map(({items}) => 
          items.map(
              client => ({key: client.name, value: client.id})
          )),
      );
  }
});

export function clientIdPropContributor(propList: FormPropList<Identity.UserItem>){
    propList.addByIndex(clientProp, 4);
}

export const identityCreateFormPropContributors: IdentityCreateFormPropContributors = {
  'Identity.UsersComponent': [clientIdPropContributor],
};

export const identityEditFormPropContributors: IdentityEditFormPropContributors = {
  'Identity.UsersComponent': [clientIdPropContributor],
};

Annotation 2020-07-23 152847

@mehmet-erim
Copy link
Contributor

Hi @rsposato06

The problem will be resolved in v3.0.5 that will be released this week.
Thanks for reporting 🙂

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

No branches or pull requests

3 participants