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

Custom form type for object property in array #767

Closed ErikSvedin closed 8 years ago

ErikSvedin commented 8 years ago

I've got an array of objects with 3 string properties "title", "description" and "icon". However I would liek to create a custom control for the icon property in order for the user to select icon from a list or a modal or whatever.

However I cant even get past the first example in the getting my custom addon to #work. I've defined the addon and cached the template. However when i use it on the icon property inside the array I get an errror in my console where schemaValidate starts complaining about lack of ngModel controller.

JSFIDDLE: http://jsfiddle.net/awa593ys/

Maybe worth noting: the custom form type works if I use it above the array eg:

this.form = [
                "title",
               {
                    key:"description",
                    type:"icon"
               },
                ...
ErikSvedin commented 8 years ago

By adding ng-model="$$value$$" to the input element i was able to resolve this issue. Closing