Nipun Parasrampuria Nipun Parasrampuria - 6 months ago 49
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 :)


Set the ngModel value:

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

$scope.myInput = "Default";