0

I can add multiple items into a dropdown in Angular Schema Form using the following schema and form.

var schema = {
    "type": "object",
    "properties": {
        "model": {
            "type": "string"
        }
    }
}

var form = [
    {
        key: "model",
        type: "uiselectmultiple",
        titleMap: {
            "Model 1", "model_1",
            "Model 2", "model_2",
            "Model 3", "model_3"
        },
        onChange: changeValues(modelValue, form)
    }   
];

The onChange method doesn't fire when selecting an item from the list. I followed this solution and still didn't get the expected result.

I can use checkboxes instead of using multi-selection. But then I would have to remove the "X" mark, "+add" button and additional header text from the checkboxes. How to handle onChange with Angular Schema Form Checkbox boolean?

Anthropic
  • 681
  • 1
  • 11
  • 29
Harshana
  • 524
  • 3
  • 16
  • Did you try the `$scope.$watch()` solution mentioned at the start of the solution issue post? – Anthropic Oct 31 '17 at 00:44
  • Can you please explain the way to use $scope.$watch? – Harshana Oct 31 '17 at 06:46
  • https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$watch Using the "function as watch expression" version, you can return the entire list of values using join and then it will trigger a change every time the list changes and there is a digest. – Anthropic Oct 31 '17 at 06:51
  • Thanks, I'll check – Harshana Oct 31 '17 at 06:53

0 Answers0