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

onChanged is not as described in the docu #909

Closed ghost closed 7 years ago

ghost commented 7 years ago

See the onChange-Events: https://plnkr.co/edit/b8PwXmyOCwrcwhZ47DZQ

I defined the onChange-Event in different ways. It only works, when a anonymous function is called.

See docu: https://github.com/json-schema-form/angular-schema-form/blob/master/docs/index.md

onChange: "valueChanged(form.key,modelValue)", // onChange event handler, expression or function and onChange: "updated(modelValue,form)"

docu says not only anonym functions.

Anthropic commented 7 years ago

"If its an expression it will be evaluated in the parent scope of the sf-schema directive" You need to add the function to the scope of your controller so ASF has access to it $scope.TestHandler = TestHandler; would suffice :)

Please re-open if you do not feel the question has been answered sufficiently.