0
這裏是angularjs
應用無法設置默認的文本框的值
<input type="text" class="input-xlarge" id="user_name" ng-model="myModel.text1"
name="user_name" rel="popover" data-content="Enter your first and last name."
data-original-title="Full Name">
我的HTML代碼,這裏是構造函數代碼
function MyCtrl2($scope) {
var initial = {text1: 'initial value'};
var ini = {text2: 'initialvalue'};
$scope.myModel = angular.copy(initial);
$scope.myModel = angular.copy(ini);
}
MyCtrl2.$inject = ['$scope'];
的默認值僅在一個文本框中usr_email
正在填充。但不在user_name
任何一點可能是錯誤的。
短一些的版本將angular.extend($ scope.myModel = {},初始時,init)。保存一行;) – matys84pl 2013-02-14 07:50:08