简体   繁体   English

AngularJS中输入文本框的默认值

[英]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? 如何在AngularJS中设置输入文本框的默认值,以便以后可以更改? I wish to be able to submit the changed value of the textbox(using ng-model) to the server. 我希望能够将文本框的更改值(使用ng-model)提交给服务器。 Would using ng-value to set the initial value of the textbox be the correct approach in this case? 在这种情况下,使用ng-value设置文本框的初始值是正确的方法吗?

Set the ngModel value: 设置ngModel值:

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

$scope.myInput = "Default";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM