1

ng-options="branch as branch.name for branch in ordersItemClientInfo.branches track by branch.id"

在我的情况下,“分支”是一个对象数组,每个对象都有指向如此深的对象(地图 geoObject)的字段引用。Angular 试图复制那个对象但失败了!

来自 angular.js:

getViewValueFromOption: function(option) {
  // If the viewValue could be an object that may be mutated by the application,
  // we need to make a copy and not return the reference to the value on the option.
  return trackBy ? angular.copy(option.viewValue) : option.viewValue;
}

我不需要副本,我需要选择原始对象。我怎样才能做到?

4

1 回答 1

0

也许你可以尝试做一个JSON.stringify(在显示之前对每个项目),然后JSON.parse在你想显示它的时候在模板中制作?

于 2015-11-24T09:16:36.780 回答