Search code examples
javascriptangularjsjsonschemaangular-schema-form

Angular schema form custom type for object property in array


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"
    },
    ...

Solution

  • For anyone with the same trouble:

    By adding ng-model="$$value$$" to the input element I was able to fix this issue.