Javascript 在Angular$范围中设置模型未绑定到multiselect ddl

Javascript 在Angular$范围中设置模型未绑定到multiselect ddl,javascript,angularjs,Javascript,Angularjs,我有一个绑定到对象数组的多选下拉列表($scope.selectedProperties): 在某个事件中,我存储所选项目的数组: $scope.updateSessionProperties = function () { CachingService.cachedSelectedProperties = $scope.selectedProperties; }; …然后在以后重新应用它们: if(CachingService.cachedSelectedProperties &am

我有一个绑定到对象数组的多选下拉列表($scope.selectedProperties):

在某个事件中,我存储所选项目的数组:

$scope.updateSessionProperties = function () {
    CachingService.cachedSelectedProperties = $scope.selectedProperties;
};
…然后在以后重新应用它们:

if(CachingService.cachedSelectedProperties && CachingService.cachedSelectedProperties.length>0){
    $scope.selectedProperties = CachingService.cachedSelectedProperties; 
}
绑定到的对象数组(selectedProperties)的结构与accountInfo相同:

[{client_name:"Client 1", is_demo:false, property_name:"Prop 1"}, 
{client_name:"Client 2", is_demo:false,  property_name:"Prop 2" }]
没有运气。。。下拉列表显示“未选择”,即使它绑定到的范围属性是相同的对象。我也尝试过执行$scope.$apply(),但是select元素不会重新绑定。

通读之后,我建议如下:

<select
    id="propertyDdl"
    multiple="multiple"
    ng-model="userSelectedProperties"
    ng-options="account.property_name group by account.client_name for account in selectedProperties">
</select>


定义的
accountInfo
在哪里?$scope.accountInfo定义在$scope的开头,是一个与模型相同的数组:[{client_name:“client 1”,is_demo:false,property_name:“client 1”},{client_name:“client 2”},{client_name:“client 3”,is_demo:false,property_name:“Prop 3”…}]有趣的是,如果我将一个项目从accountInfo推送到selectedProperties中,绑定确实会起作用,但是以任何其他方式将相同的项目推送到selectedProperties中都会失败。
[{client_name:"Client 1", is_demo:false, property_name:"Prop 1"}, 
{client_name:"Client 2", is_demo:false,  property_name:"Prop 2" }]
<select
    id="propertyDdl"
    multiple="multiple"
    ng-model="userSelectedProperties"
    ng-options="account.property_name group by account.client_name for account in selectedProperties">
</select>