Not detecting auto fill with javascript

Viewed 63

I am working on a project. My goal is to automatically fill in data on a website. But when I run the JavaScript code just like this:

document.getElementsByClassName('form-control')[1].value = "MYTEXT";

The form is changing. But when I click the submit button it says this is empty. I think this website using Angular Js.

This is what I'm working on


<input spellcheck="false" autocapitalize="none" 
       class="form-control input-sm ng-pristine 
              ng-untouched ng-valid ng-empty ng-valid-maxlength" 
       type="text" ng-model="render.etudName" maxlength="60" 
       ng-change="saveRenderer()" >

How do I solve this problem?

HTML Document is too long. Some of the html.

<html class="no-js ng-scope" lang="tr" ng-app="VitaminMiddleSchoolApp" id="ng-app" xmlns:ng="http://angularjs.org"><!--<![endif]--><head><style type="text/css">[uib-typeahead-popup].dropdown-menu{display:block;}</style><style type="text/css">.uib-time 


<!-- uiView: main --><div ui-view="main" class="vc-fullHeight ng-scope" autoscroll="false" style=""><div ng-controller="mainViewController" class="ng-scope"> <!-- ngIf: !render.shouldUpdatePass --><div ng-if="!render.shouldUpdatePass" id="componentMainView" class="vc-fullHeight ng-scope" fullscreen="false" header-scrolled="false" ng-switch="headerType" 


<div class="p-h-xxs ng-binding">Canlı Ders Başlığı *</div> <input spellcheck="false" autocapitalize="none" class="form-control input-sm ng-pristine ng-untouched ng-valid ng-empty ng-valid-maxlength" type="text" ng-model="render.etudName" maxlength="60" ng-change="saveRenderer()"> </div> <div class="col-sm-3 p-xs"> <div class="p-h-xxs ng-binding">Sınıf *</div> <select class="form-control input-sm ng-pristine ng-untouched ng-valid ng-not-empty" name="grade" ng-change="gradeChanged()" ng-options="grade as grade.name for grade in render.grades" ng-model="render.selectedGrade" style=""><option label="5. Sınıf" value="object:3634" selected="selected">5. Sınıf</option><option label="6. Sınıf" value="object:3635">6. Sınıf</option><option label="7. Sınıf" value="object:3636">7. Sınıf</option><option label="8. Sınıf" value="object:3637">8. Sınıf</option></select> </div> <div class="col-sm-3 col-xs-6 p-xs" 

1 Answers

You can try to change the $scope. Like this:

    document.getElementsByClassName('form-control')[1].scope().value = "MYTEXT";

Read more about the $scope usage in AngularJS from here.

Related