Reputation: 271
I've got error message like "TypeError: (intermediate value)(intermediate value).val(...).prop is not a function" on console log after get selected option from $scope. Please check out what's wrong from my script:
HTML Template:
<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);
})
}}
])
How I can fix it?
Note: DOLLTYPE is an example name for services.js for query data with cordova sqlite plugin
Upvotes: 2
Views: 2584
Reputation: 506
Sometimes this can be triggered when you forget a semicolon. You seem to have forgotten to put semicolons:
$scope.dolltype.push({id:itemtype.id, name:itemtype.name}) ; <---
DOLLTYPE.get(...).then(...) ; <---
and the DOLLTYPE.all().then(...) ; <---
this can sometimes break when you minify
Upvotes: 1