json-schema-form / angular-schema-form

Generate forms from a JSON schema, with AngularJS!
https://json-schema-form.github.io/angular-schema-form
MIT License
2.47k stars 653 forks source link

API /Remote service data is not populating ( angular-schema-form-dynamic select) #881

Closed kirantejj closed 7 years ago

kirantejj commented 7 years ago

scenario 1 :working with static data

xyz.ts

public populateTitleMap() { var vm = this;

        return [
              { value: "value1", name: "text1" },
             { value: "value2", name: "text2" },
               { value: "value3", name: "Select dynamic!" }
           ];

}


scenario 2 : not working for dynamic data(api call)

xyz.ts file

public populateTitleMap(id:any) { var vm = this; var data; var collection; vm.taskService.getDictionaryData(id).then(function (response) { data = response.data; var x = data.split(',')[0]; var y = data.split(',')[1];

collection= [{ value: x, name: y }, { value: x, name: y }]; return collection; }); }

the Above code returns data but it is not binding to dropdown whyyyyyyyyyyyyyyy?

it is showing error message as

  1. A callback string must match name of a function in the parent scope undefined 2.Possibly unhandled rejection: A callback string must match name of a function in the parent scope undefined

abcd.cs

callback = "vm.populateTitleMap(" + entityAttribute.enum_type + ")"

please send a quick response to this thread........

Enhancement

As a user/developer, when I ... I should be able to ...

Expected behaviour

I expected ...

Actual behaviour

It actually ...

Gist/Plunker/Demo

Description

Related issues

This is/maybe related to ...

@json-schema-form/angular-schema-form-lead

Anthropic commented 7 years ago

@kirantejj I'm sorry but I can't help you any more than to say look at the two add-ons that already do dynamic select and replicate how they do it or use one of them. http://github.com/Anthropic/angular-schema-form-external-options http://github.com/OptimalBPM/angular-schema-form-dynamic-select

As your issue is with angular-schema-form-dynamic-select, I suggest you post an issue with Nicklas so he can take a look on their issue manager.