如何在x-editable angularjs的select下拉列表中获得所选值
How do i get the selected value in select dropdown of x-editable angularjs
我在angularjs中使用x-editable。
当我提交选择时。
我没有得到文件中给出的$data的新值
这是小提琴http://jsfiddle.net/NfPcH/7014/
脚本:
var app = angular.module("app", ["xeditable", "ngMockE2E"]);
app.run(function(editableOptions) {
editableOptions.theme = 'bs3';
});
app.controller('Ctrl', function($scope, $q, $http) {
$scope.items = ['a','b','c'];
$scope.user = {
id: 1,
name: 'a'
};
$scope.updateUser = function(data) {
alert(data);
$scope.console = data;
return $http.post('/updateUser', {id: $scope.user.id, name: data});
};
});
// mock `/updateUser` request
app.run(function($httpBackend) {
$httpBackend.whenPOST(/'/updateUser/).respond(function(method, url, data) {
data = angular.fromJson(data);
if(data.name === 'error') {
return [500, 'Error message'];
} else {
return [200, {status: 'ok'}];
}
});
});
有人能帮我吗?我如何获得更新的价值?
您的问题是试图读取html中的s.text,但您的数组中没有文本键!
更改。。。。
ng-options="s.text as s for s in items"
至
ng-options="s for s in items"
它似乎起了作用。
http://jsfiddle.net/v983ryrk/1/
相关文章:
- 如何在x-editable angularjs的select下拉列表中获得所选值
- 在JavaScript中捕获select(下拉列表)上的键输入
- select下拉列表和promise-短暂的空选择
- 如何获得Materialize select下拉列表以使用React
- 使用split()从select下拉列表中填充文本字段值
- AngularJS ui-select - 不选择下拉列表中的选项
- jQuery - select 下拉列表 - focusout 在 select 之前触发
- 使用 Javascript/jQuery 以编程方式关闭 SELECT 下拉列表
- 使用 Jquery 将 SelectListItems 的 JSON 列表映射到下拉列表 Select List 并指示
- 没有响应.chzn-select两个带有ajax和codeigniter的下拉列表
- 如何使用ajax在select下拉列表中填充json数据
- 可编辑下拉列表(g:select)grails
- 使用php的动态变量从sql select和update语句的下拉列表中获取
- 使用Angular.js和PHP在select下拉列表中获取问题
- 要添加的搜索功能&从select下拉列表中删除选项
- 如何在javascript中只使用类名更改select下拉列表中的值
- 使用bootstrap-select.js根据第一个下拉列表更改第二个下拉列表的选项
- 当选项包含空格时,在select下拉列表中动态追加值会在下拉列表中追加空字段
- 如何在使用jquery点击select时刷新下拉列表
- 在html表的foreach绑定中,是否有可能将数据绑定到一个带有knockout的select下拉列表?