alaskaman
alaskaman

Reputation: 49

How to force input field value validation?

I am writing a script that fill information to website's form and then submit it. I enter the data to input field by document.getElementById("input_field_id").value = "value";; form before being submitted has to be validated by AngularJS code, but when data pops up in the field it's not validated, how can i force that?

Code sample: https://plnkr.co/edit/VuLLF7FRc3kg6gFj3EB3?p=preview /code is not mine, i use this as a example of my problem/

Upvotes: 0

Views: 403

Answers (1)

machinehead115
machinehead115

Reputation: 1657

By using document.getElementById you are executing that outside of the Angular scope, therefore your app isn't aware of these changes. You need to do it inside you controller instead, like this:

$timeout(function() {
  $scope.current.name = "asdasd";
}, 1500);

Upvotes: 1

Related Questions