Nipun Parasrampuria Nipun Parasrampuria -5 years ago 283
AngularJS Question

Default value of input textbox in AngularJS

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?

PS: This is my first question on StackOverflow, so please be generous in case there are any ambiguities in my question :)

Answer Source

Set the ngModel value:

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

$scope.myInput = "Default";
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download