Hi there I would like to autofill a page on loading which is include ng-repeat parameter. well I need a script to doing this and automatically click on one of the option appear. the following code is the html code of the page.
I wrote this script but did not work. document.querySelectorAll('.sd-Items')[1].click();
<div class="sd-titleSideBar">
<strong>Color Selection</strong>
</div>
<div class="sd-selectColor">
<!-- ngRepeat: color in model.colors -->
<div ng-repeat="color in model.colors" class="inventory sd-Items ng-scope
selectedItem" ng-class="
{'selectedItem': color.id == selectedColor}" ng-click="colorClick(color.id)">
<div style="width: 30px; height: 30px; border-width: 2px; border-style:
ridge !important; background-color: rgb(255, 255, 255);" class="col-md-1" ng-style="{'background-color': color.omi}"></div>
<label class="ng-binding"> White</label>
<!-- ngIf: !color.ohc -->
</div><!-- end ngRepeat: color in model.colors -->
<div ng-repeat="color in
model.colors" class="inventory sd-Items ng-scope" ng-class="
{'selectedItem': color.id == selectedColor}" ng-click="colorClick(color.id)">
<div style="width: 30px; height: 30px; border-width: 2px; border-style:
ridge !important; background-color: rgb(25, 25, 175);" class="col-md-1" ng-style="{'background-color': color.omi}"></div>
<label class="ng-binding"> Blue</label>
<!-- ngIf: !color.ohc -->
</div><!-- end ngRepeat: color in model.colors -->
</div>
If you're calling methods of AngularJs, then you need to define those methods inside controller for that element.
You can get more information from this webpage and this tutorial for angularjs.
https://www.w3schools.com/angular/angular_databinding.asp
See AngularJS controller section.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.