我正在尝试填充组合框,我收到以下错误: 错误:select中不允许重复的md-option值。重复值" companyPdfSequence.CompNo"找到。
<md-input-container class="md-block" flex-gt-xs>
<label>Company</label>
<md-select ng-model="selectedCompanySequencePdf" required ng-change="changeCompanySequencePdf(selectedCompanySequencePdf)">
<md-option ng-repeat="companyPdfSequence in companiesPdfSequences" value="companyPdfSequence.CompNo">{{companyPdfSequence.Company}}</md-option>
</md-select>
companiesPdfSequences的价值是:[{&#34; CompNo&#34;:&#34; 1&#34;,&#34;公司&#34;:&#34; Test1&#34;},{& #34; CompNo&#34;:&#34; 2&#34;&#34;公司&#34;:&#34; Test2的&#34;}]
答案 0 :(得分:1)
更改
value="companyPdfSequence.CompNo"
到
value="{{companyPdfSequence.CompNo}}"
属性的绑定是基于文本的。它抱怨值是相同的,因为变量被解释为纯文本
"companyPdfSequence.CompNo" == "companyPdfSequence.CompNo"
取代意图;
1 == 2