Html 用数据填充输入
我正在尝试使用以下编辑按钮从DB获取编辑表单的数据:Html 用数据填充输入,html,angularjs,Html,Angularjs,我正在尝试使用以下编辑按钮从DB获取编辑表单的数据: <button ui-sref="dashboard.modifierCand" type="button" class="btn btn-outline btn-info" ng-click="update(item._id)">Editer</button> 在控制台中,我可以看到id和登录名,但它不在输入中 您是否尝试使用JQuer
<button ui-sref="dashboard.modifierCand" type="button" class="btn btn-outline btn-info" ng-click="update(item._id)">Editer</button>
在控制台中,我可以看到id和登录名,但它不在输入中
您是否尝试使用JQuery更改输入字段的值?您在哪里调用
update
函数?我有所有用户的表,还有一个编辑按钮Editer@MarouenAyadi你能用这个代码更新你的问题吗?这会更有帮助吗?:)您不需要jquery来完成此任务!!!只需将值分配给ng-model。您是否尝试使用JQuery更改输入字段的值?您在哪里调用更新函数?我有所有用户的表,并且有一个编辑按钮Editer@MarouenAyadi你能用这个代码更新你的问题吗?这会更有帮助吗?:)您不需要jquery来完成此任务!!!只需将值指定给ng模型。
<input type="text" class="form-control" ng-model="newlogin">
$scope.update = function (id) {
console.log("this is the id " + id)
$http ({
header: 'content-type:application/json',
url: '/ReadCandById/' + id,
method: 'GET',
}).success(function (user) {
$scope.user = user[0];
$scope.newlogin = user[0].Login;
console.log($scope.newlogin)
})
}