Reputation: 4886
I have created an application in angularjs with xeditable plugin, The application is working fine but the issue is that when i click the edit button and change the select option to some other, and when click save, it is not saving, I am having a nested json for status field like as shown below
Can anyone tell me some solution for this
$scope.users = [
{id: 1, name: 'awesome user1', status: {uid: 2, text: 'status2'}, group: 4, groupName: 'admin'},
{id: 2, name: 'awesome user2', status: undefined, group: 3, groupName: 'vip'},
{id: 3, name: 'awesome user3', status: {uid: 2, text: 'status2'}, group: null}
];
Upvotes: 0
Views: 233
Reputation: 1008
{{ user.status }} contains only object like this {uid:#} when you pick value that`s the problem, you can solve this as same as you solved groups
change
{{user.status}}
to
{{showStatus(user)}}
and change your showStatus method, beacuse its wrong
selected = $filter('filter')($scope.statuses, {value: user.status});//old and wrong
selected = $filter('filter')($scope.statuses, {uid: user.status.uid}); // correct
Upvotes: 1