select by default value for dropdown not working by using 'track by' in angualrjs

前端 未结 2 533
温柔的废话
温柔的废话 2021-01-25 20:57

I am using track by to avoid strange values ::string that are appending to value but when i select by default dropdown , dropdown is not g

2条回答
  •  独厮守ぢ
    2021-01-25 21:49

    This will work:

    $scope.data = { availableOptions: [ {id: 1, name: 'Option A'}, {id: 2, name: 'Option B'}, {id: 3, name: 'Option C'} ], selectedOption: {id: 2, name: 'Option B'} };

    http://plnkr.co/edit/yOPa3hb2nSgkpOfu8NbT?p=preview

提交回复
热议问题