Default value of input textbox in AngularJS

Nipun Parasrampuria picture Nipun Parasrampuria · Jul 2, 2015 · Viewed 28.8k times · Source

How do I set the default value of an input textbox in AngularJS so that it can be altered later? I wish to be able to submit the changed value of the textbox(using ng-model) to the server. Would using ng-value to set the initial value of the textbox be the correct approach in this case?

Answer

tymeJV picture tymeJV · Jul 2, 2015

Set the ngModel value:

<input type="text" ng-model="myInput" />

$scope.myInput = "Default";