Hello Everyone!
I would like to set/change a value in a dropdown menu that has been written
in AngularJS in the Debugger located in the Developer Tools.
Below you will find a HTML code copied from DOM of the element:
<select name="creditReason"
class="input-group ng-pristine ng-isolate-scope ng-empty ng-invalid
ng-invalid-required ng-touched"
id="creditReason"
required="required"
ng-change="change ? change() : _.noop()"
ng-model="model"
ng-options="type.value as type.name for type in list"
ng-disabled="(disableField || disabled)"
ng-required="lookupRequired"
ng-attr-id="{{lookupId}}"
model="confirmDialogCtrl.creditReasonCodeId"
lookup="creditReasons"
lookup-required="true"
lookup-name="creditReason"
lookup-id="creditReason"
ng-attr-name="{{lookupName}}">
<option selected="selected" value="?"></option>
<option value="number:39001" label="Customer Request">Customer
Request</option>
<option value="number:39002" label="Discount Not Applied">Discount Not
Applied</option>
<option value="number:39003" label="Duplicate Billing">Duplicate
Billing</option>
<option value="number:39004" label="Incorrect Address">Incorrect
Address</option>
<option value="number:39005" label="Incorrect Billing Method">Incorrect
Billing Method</option>
<option value="number:39006" label="Incorrect Cost Center">Incorrect Cost
Center</option>
<option value="number:39007" label="Incorrect Customer/Season">Incorrect
Customer/Season</option>
<option value="number:39008" label="Incorrect PO">Incorrect PO</option>
<option value="number:39009" label="Incorrect Rate">Incorrect Rate</option>
<option value="number:39010" label="Incorrect Rental Period">Incorrect Rental
Period</option>
<option value="number:39011" label="Sales Tax">Sales Tax</option>
<option value="number:39012" label="Other">Other</option></select>
I have tried following methods:
angular.element(
getElementsByClassName('input-group ng-pristine ng-isolate-scope ng-empty
ng-invalid ng-invalid-required ng-touched')[0]).scope().model = 'Incorrect PO'"
angular.element(document.getElementsByClassName("input-group ng-pristine
ng-isolate-scope ng-empty ng-invalid ng-invalid-required ng-touched
")[0]).scope().$apply(() => $scope.model = "number:39001")
However none of them worked.
Could you please advise how can I change the dropdown's value from the Console?
Thanks!
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/angular/930a38eb-b658-4576-9c3c-c8ce92046458%40googlegroups.com.