angularjs:$ index在控制器中未定义

时间:2018-05-18 19:43:16

标签: javascript html angularjs



<div class="md-dialog-content">
                <md-dialog-content ng-keydown="vm.error = '';">
                        <div layout-gt-xs="row" layout="column">
                            <!-- Payor Agreement -->
                        <!-- <md-input-container>    -->
                            <md-autocomplete id="PYRDetailAscPayAgr{{$index}}" md-require-match="true" class="md-block" md-input-name="autocompleteField1" required
                            md-mid-minlength="2" md-no-cache="true" md-search-text="payorAgreementSearcher" md-selected-item="vm.payor.associatedpayoragreements[$index].payoragreementuid.name"
                            title="{{vm.payor.associatedpayoragreements[$index].payoragreementuid.name}}" md-items="item in vm.queryPayorAgreement(payorAgreementSearcher,$index)"
                            md-item-text="item.name" md-selected-item-change="vm.updateAssociatedPayorAgreement(item, $index)" md-floating-label="{{'MENU.BILLINGCONFIGURATION.PAYORAGREEMENT' | translate}}"
                            flex="100">
                            <md-item-template>
                                <span md-highlight-text="payorAgreementSearcher">{{ '(' + item.code + ') ' + item.name }}</span>
                                <md-tooltip>{{'(' + item.code + ') ' +item.name }}</md-tooltip>
                            </md-item-template>
                            <md-not-found>
                                <span translate>ERRORS.NOMATCHES</span>
                            </md-not-found>
                        </md-autocomplete>
</div>
</md-dialog-content>
</div>
&#13;
&#13;
&#13;

&#13;
&#13;
 function updatePayorAgreement(selectedAgreement, index) {
                console.log(selectedAgreement);
                console.log(index);
                if (selectedAgreement && selectedAgreement._id && selectedAgreement.name) {
                    $timeout(function () {
                        vm.diagnosiscoverage[index].payoragreement = {
                            _id: selectedAgreement._id,
                            name: selectedAgreement.name
                        };
                        vm.diagnosiscoverage[index].payoragreement = selectedAgreement._id;
                    }, 100);
                }
            };
&#13;
&#13;
&#13;

updatePayorAgreement()中,我从HTML传递索引。但它在控制器中显示未定义的值。如何在控制器中获取索引值?

0 个答案:

没有答案