AngularJS 1.4.0-rc.2当

AngularJS 1.4.0-rc.2当,angularjs,angularjs-ng-options,Angularjs,Angularjs Ng Options,好的,所以我决定做一个预发布的Angular,以利用ngOptions内部的新“disable when”。我不确定允许我摆弄的范围。以下是按预期工作的代码,其中一个变量已删除: <select multiple ng-model="CoBorrowerIds" ng-options="person.Id as (person.LastName + ', ' + person.FirstName) disable when (person.Id==1) for person

好的,所以我决定做一个预发布的Angular,以利用ngOptions内部的新“disable when”。我不确定允许我摆弄的范围。以下是按预期工作的代码,其中一个变量已删除:

        <select multiple ng-model="CoBorrowerIds" ng-options="person.Id as (person.LastName + ', ' + person.FirstName) disable when (person.Id==1) for person in Persons"></select>

id为1的数组已禁用。但是,我的代码不起作用:

        <select ng-model="BorrowerId" ng-options="person.Id as (person.LastName + ', ' + person.FirstName) for person in Persons"></select>

        <select multiple ng-model="CoBorrowerIds" ng-options="person.Id as (person.LastName + ', ' + person.FirstName) disable when (person.Id==BorrowerId) for person in Persons"></select>


所以我的问题是:我是否可以访问“禁用时间”中的范围?如果我这样做了,我做错了什么?

我决定在父元素中添加一个ng repeat语句,从而需要显式定义范围。现在改为:

        <select ng-model="loan.BorrowerId" ng-options="person.Id as (person.LastName + ', ' + person.FirstName) for person in Persons" class="form-control"></select>{{BorrowerId}}

        <select multiple ng-model="loan.CoBorrowerIds" ng-options="person.Id as (person.LastName + ', ' + person.FirstName) disable when (person.Id==loan.BorrowerId) for person in Persons" class="form-control"></select>
{{BorrowerId}
…而且效果很好。这可能是一个错误,或者是我糟糕的想法。然而,不管它值多少钱,答案是存在的