gpt4 book ai didi

javascript - TypeError : (intermediate value)(intermediate value). val(...).prop 不是函数( ionic )

转载 作者:行者123 更新时间:2023-11-30 00:26:55 24 4
gpt4 key购买 nike

在从$范围。请检查我的脚本有什么问题:

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 s​​qlite 插件查询数据

最佳答案

有时这会在您忘记分号时触发。你好像忘了加分号:

$scope.dolltype.push({id:itemtype.id, name:itemtype.name}) ; <---

DOLLTYPE.get(...).then(...) ; <---

和 DOLLTYPE.all().then(...) ; <---

当你缩小时这有时会中断

关于javascript - TypeError : (intermediate value)(intermediate value). val(...).prop 不是函数( ionic ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31096897/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com