Correct processing of ng-required option when model changes from js