[英]select showing undefined but console log shows value angularjs
我的选择如下
<div class="inputCol">
<label>{{'FrequentBeneficiary' | translate}}</label>
<select ng-model="params.beneficiary" ng-options="option.Name as option.Name for option in beneficiaryData"></select>
</div>
</div>
我的服务电话代码:
bcsSQLiteStorage.getDataDB(BeneficiariesKey).then(function (data) {
if (data.rows.length > 0) {
console.log("entrou no data.rows.length");
$scope.beneficiariesData = angular.fromJson(data.rows.item(0).value);
$scope.AccountLoaded = true;
MobileLoading.Ionic.hide();
console.log("Beneficiaries Data " + JSON.stringify($scope.beneficiariesData));
$scope.params.beneficiary = $scope.beneficiariesData[0].Name;
console.log($scope.params.beneficiary);
}
和我的console.log打印名称就好
console.log($scope.params.beneficiary);
prints the name correctly, does not print undefined
但是我的选择在测试时显示未定义,为什么? 我的选择有问题吗?
定义$ scope.params.beneficiary = null,然后再在服务功能块外部调用service手段,然后再次测试
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.