在从TypeError选择选项之后,我在控制台日志中得到了类似于“.val:(中间值)(中间值).val(.).prop不是函数”之类的错误消息。请查查我的剧本出了什么问题:
HTML模板:
<ion-view view-title="Doll List">
<ion-content class="has-header">
<div class="list">
<label class="item item-input item-select">
<div class="input-label">
Product
</div>
<select name='options2' ng-model="item.doll" ng-options="DOLLtype as DOLLtype.name for DOLLtype in dolltype track by DOLLType.id">
</select>
</label>
</div>
</ion-content>
</ion-view>controller.js
.controller('DollCtrl', ['$scope', '$stateParams', '$location', '$http', '$window', '$q', '$localStorage', '$rootScope', '$filter', 'DOLLTYPE','$timeout', function($scope, $stateParams, $location, $http, $window, $q, $localStorage, $rootScope, $filter, DOLLTYPE, $timeout) {
$scope.item = [];
$scope.item = {
id: $stateParams.id
};
$scope.dolltype = [];
DOLLTYPE.get($scope.item.id).then(function(itemtype) {
$scope.dolltype.push({id:itemtype.id, name:itemtype.name})
$scope.item.doll = $scope.dolltype[0];
console.log($scope.item.doll);
})
DOLLTYPE.all().then(function(dolltype){
$scope.dolltype=dolltype;
console.log($scope.dolltype);
})
}}
])我怎么才能修好它?
注意: DOLLTYPE是services.js的示例名称,用于使用cordova sqlite查询数据。
发布于 2017-06-06 17:11:08
有时,当你忘记分号时,就会触发这种情况。你好像忘了用分号:
$scope.dolltype.push({id:itemtype.id,name:itemtype.name}) ; <--
DOLLTYPE.get(.).then(.) ; <--
和DOLLTYPE.all().then(.) ; <
当你缩小的时候,这有时会被打破。
https://stackoverflow.com/questions/31096897
复制相似问题