ng-options="branch as branch.name for branch in ordersItemClientInfo.branches track by branch.id"
在我的例子中,“branches”是一个对象数组,每个对象都有字段引用到如此深的对象(map 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;
}
我不需要副本,我需要选择原始对象。我该怎么做?
答案 0 :(得分:0)
也许您可以尝试JSON.stringify
(在显示每个项目之前),然后在想要显示模板时在模板中创建JSON.parse
?