Javascript 为什么角度可编辑不';t在第一次运行时突出显示当前值?
我使用带有下拉列表的angular xeditable进行就地编辑,如()。奇怪的是,当我在页面加载后点击xeditable链接时,我没有看到当前值高亮显示为selected。你知道为什么会这样吗 HTMLJavascript 为什么角度可编辑不';t在第一次运行时突出显示当前值?,javascript,html,angularjs,x-editable,Javascript,Html,Angularjs,X Editable,我使用带有下拉列表的angular xeditable进行就地编辑,如()。奇怪的是,当我在页面加载后点击xeditable链接时,我没有看到当前值高亮显示为selected。你知道为什么会这样吗 HTML 人: 地位: Javascript app.run(函数(可编辑选项){ editableOptions.theme='bs3'; }); 应用程序控制器('Ctrl',函数($scope,$filter){ $scope.user={ 现状:2, 姓名:2 }; $scope.statu
人:
地位:
Javascript
app.run(函数(可编辑选项){
editableOptions.theme='bs3';
});
应用程序控制器('Ctrl',函数($scope,$filter){
$scope.user={
现状:2,
姓名:2
};
$scope.status={
'1':{text:'status1'},
'2':{text:'status2'},
'3':{text:'status3'},
'4':{text:'status4'}
};
$scope.people={
'1':{text:'p1'},
'2':{text:'p2'},
'3':{text:'p3'},
'4':{text:'p4'}
};
});
我不喜欢我选择的属性名称,但我更喜欢使用数组,如果使用对象,这个问题是可以解决的:
<div ng-app="app" ng-controller="Ctrl">
Person: <a href="#"
editable-select="user.person"
buttons="no"
e-ng-options="p.text for p in people track by p.value"> {{user.person.text}} </a>
</div>
app.controller('Ctrl', function($scope, $filter) {
$scope.people = [
{ value: '1', text: 'p1' },
{ value: '2', text: 'p2' },
{ value: '3', text: 'p3' },
{ value: '4', text: 'p4' }
];
$scope.user = {person: $filter('filter')($scope.people, {value : 3})[0]};
});
人:
应用程序控制器('Ctrl',函数($scope,$filter){
$scope.people=[
{值:'1',文本:'p1'},
{值:'2',文本:'p2'},
{值:'3',文本:'p3'},
{值:'4',文本:'p4'}
];
$scope.user={person:$filter('filter')($scope.people,{value:3})[0]};
});
另外,它不能与您引用的AngularJS版本一起使用,因为它是一把可以工作的小提琴