title: How to input data into AngularJS forms using Javascript?
body: <p>The angularJS form is given below this question. what i want to do is change the value of <code>#quantity</code> input from 1 to 200 using JavaScript and then click on the Buy button. But after i submit the form by clicking on the Buy button, the value of <code>#quantity</code> input returns to its default value which is 1.
  <a href="https://i.stack.imgur.com/NE9h6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NE9h6.png" alt="The AngularJS form"></a>
  I tried the following code to change the value of <code>#quantity input</code> element:</p>
  
  <pre><code>var qty = document.getElementById('quantity');
  var buy = document.querySelector('button.btn.place');
  qty.value = "123";  
  qty.select();
  buy.click();`
  </code></pre>
  
  <p>But it doesn't work. It always rejects the value. Sorry, i don't have any knowledge about AngluarJS and also it will take a lot of time for me to learn AngularJS.</p>
  
  <p>Here is the code for the <strong>QTY</strong> input element:</p>
  
  <pre><code>&lt;input type="number" step="1" id="quantity" name="quantity" ng-model="options.quantity" class="input width-100 numeric ng-isolate-scope ng-valid-number ng-valid-checklotsize ng-dirty ng-valid-required ng-valid ng-valid-integer" min="1" checklotsize="1" integer="" esc-key="" esc-key-action="close()" ng-disabled="!uiConstraints.quantity" required=""&gt;
  </code></pre>
  
  <p>and the <strong>BUY</strong> button:</p>
  
  <pre><code>&lt;button type="submit" class="btn place btn-blue" ng-class="options.transaction_type == 'BUY' ? 'btn-blue' : 'btn-orange'" ng-disabled="buysellform.$invalid || order_status === true"&gt;
  &lt;span class="spinner icon ng-hide" ng-show="order_status === true"&gt;
      &lt;span class="icon icon-spinner animate-spin"&gt;&lt;/span&gt;
  &lt;/span&gt;
  &lt;span class="icon ng-hide" ng-show="order_status !== true &amp;amp;&amp;amp; execution_type == 'MODIFY'"&gt;MODIFY&lt;/span&gt;
  &lt;span class="icon ng-binding" ng-show="order_status !== true &amp;amp;&amp;amp; execution_type == 'PLACE'"&gt;BUY&lt;/span&gt;&lt;/button&gt;
  </code></pre>