我想在我的Values变量中存储文本框的值,但它不保存我不知道为什么有人帮我请?我是新的angularjs这就是为什么我在这里请帮助我我想从文本框的商店价值,我进入我的文本框ff看到下面的图像,但我检查我的控制台文件显示'网站名称'我认为它从我的硬编码价值,但我想从文本数据如何在范围变量中保存文本框的值angularjs
$scope.form = {
site_name: 'Site name',
street_address: 'Street address',
city: 'City',
state: 'state',
country: 'country',
zip_code: 'zip_code',
phone_number: 'phone_number'
};
$scope.addRow = function() {
$scope.i++;
$scope.array = [];
for(var i = 0; i < $scope.i; i++) {
$scope.array.push(i);
}
}
var checkprofile = $scope.Profile.id;
$(".alert").hide();
$scope.updateProfile = function() {
console.log('updateProfile');
console.log($scope.form);
$scope.Profile.addresses.push($scope.form);
$scope.tempObject={full_name:$scope.Profile.full_name,
mobile_number:$scope.Profile.mobile_number,
company_name:$scope.Profile.company_name,
designation: $scope.Profile.designation,
addresses: $scope.Profile.addresses,
payment_info: $scope.Profile.payment_info
};
$http.put(properties.customerupdate_path + "/"+checkprofile,$scope.tempObject).success(function (response) {
// window.location.href = '/customerprofile';
});
}
我按一下按钮后,输入值“FF”“FF”“FF”在我的文本框...下面的代码不会从文本框获取数据,它让我的上述数值我不“知道为什么
$scope.updateProfile = function() {
console.log('updateProfile');
console.log($scope.Values);
//结果 - > [对象{SITE_NAME = “网站名称”,STREET_ADDRESS =“街 广告礼服”,市= “城市”,更...}]
}
HTML //
<tr ng-repeat="lines in array">
<td><input type="text" class="form-control" id="inputDefault" ng-model='Values.site_name ' name='site_name'></td>
<td><input type="text" class="form-control" id="inputDefault" ng-model='Values.street_address ' name='street_address'></td>
<td><input type="text" class="form-control" id="inputDefault" ng-model='Values.city ' name='city'></td>
<td><input type="text" class="form-control" id="inputDefault" ng-model='Values.state ' name='state'></td>
<td><input type="text" class="form-control" id="inputDefault" ng-model='Values.country ' name='country'></td>
<td><input type="text" class="form-control" id="inputDefault" ng-model='Values.zip_code ' name='zip_code'></td>
<td><input type="text" class="form-control" id="inputDefault" ng-model='Values.phone_number ' name='phone_number'></td>
</tr>
更新个人资料
貌似$ scope.values是一个列表,但你使用它作为NG模型 – ngrj
我想对象.... –