gpt4 book ai didi

ionic-framework - ionic ios9错误: [ng:areq] Argument ‘TabCtrl’ is not a function, got undefined

转载 作者:行者123 更新时间:2023-12-03 07:53:40 26 4
gpt4 key购买 nike

我仅在 ios 9中收到此错误。ios 10android和浏览器中正常工作。我真的不明白为什么仅在 ios 9 中会发生这种情况

注意:当我清洁contoller内的代码时,可以正常工作。

我的代码:

angular.module('starter')

.controller('TabsCtrl', function($scope, $rootScope, $ionicPlatform, $state, $cordovaCamera, $cordovaFileTransfer, $cordovaFile, $ionicLoading, $ionicTabsDelegate, $ionicModal, $ionicActionSheet, AuthService, httpService, imageService, API) {

// initialize tab's modal page
$scope.profile_picture = "img/profile.jpg";
$scope.social = {};
$scope.pic = {};
$ionicPlatform.onHardwareBackButton(function(event){
if (window.localStorage['is_user_info_compelete'] != 1) {
ionic.Platform.exitApp();
}
})

window.localStorage['is_user_info_compelete'] = 1;


$scope.getStateByServer = function() {
httpService.handleRequest(new Array(), API.url+'state/getAll', function() {}, function() {}, '').then(function(result) {
$scope.$broadcast('scroll.refreshComplete');
$rootScope.states = result.data[0];
$rootScope.cities = result.data[1];
$scope.states = $rootScope.states;
$scope.cities = $rootScope.cities;
$scope.citiesByState = [];
});
}
$scope.getStateByServer();




// Modal
modalOptions = {scope: $scope, animation: 'slide-in-up', backdropClickToClose: false, hardwareBackButtonClose: false};
$ionicModal.fromTemplateUrl('my-modal.html', modalOptions).then(function(modal) {
$scope.modal = modal;
if (window.localStorage['is_user_info_compelete'] != 1) {
setTimeout(function() {
$scope.modal.show();
}, 1200);
}
});


/**
* Save all information of the model
* Use json_decode for moreData in php like: json_decode($this->input->post("data"));
* index 'data' is the name of object in httpService.handleFileSender
*/
$scope.saveSocialInfo = function(social, city) {

if (!$scope.socialValidate(social, city)) {return false;}

data = {picture:$scope.profile_picture, city:city, social:social, uploadDirectory: 'upload/profile'};
moreData = [
{token:window.localStorage['yourTokenKey']},
{social:social}
];

$ionicLoading.show();
httpService.handleFileSender(data, moreData, API.url+'social/save/t2AkQ6df0W').then(function(result){
$ionicLoading.hide();
if (JSON.stringify(parseInt(result.response)) == 1) {
window.localStorage['is_user_info_compelete'] = 1;
$scope.modal.hide();
}
else {
httpService.popup('خطا', 'ارسال انجام نشد. لطفا مجددا تلاش نمایید.')
}
})
}


// Action Sheet
$scope.showActionSheet = function(indexPic = false, width = 500, height = 500, allowEdit = true) {

var hideSheet = $ionicActionSheet.show({
buttons: [
{text: 'گرفتن عکس'},
{text: 'انتخاب از گالری'}
],
destructiveText: 'پاک کردن',
titleText: 'انتخاب یا گرفتن عکس',
cancelText: 'لغو',
destructiveButtonClicked: function() {
$scope.profile_picture = "img/profile.jpg";
return true;
},
buttonClicked: function(index) {
option = { width:width, height:height, allowEdit:allowEdit, quality:80 }
imageService.getImage(index, option).then(function(imageURL) {
if (imageURL) {
$scope.profile_picture = imageURL;
if (indexPic) {$scope.pic[indexPic] = imageURL;}
}
})
return true;
}
});
};



$scope.socialValidate = function(social, city) {
var title = 'خطا.';
if ($scope.profile_picture == "img/profile2.jpg") {
httpService.popup(title, 'اطفا تصویر خود را انتخاب نمایید.');
return false;
}
if (!httpService.validateObject(social)) {
httpService.popup(title, 'حداقل یکی از شبکه های اجتماعی را باید پر کنید.');
return false;
}
if (!city) {
httpService.popup(title, 'اطفا شهر خود را انتخاب کنید.');
return false;
}
return true;
}


// Handle tabs swipe
$scope.goForward = function () {
var selected = $ionicTabsDelegate.selectedIndex();
if (selected != -1) {
$ionicTabsDelegate.select(selected + 1);
}
}
$scope.goBack = function () {
var selected = $ionicTabsDelegate.selectedIndex();
if (selected != -1 && selected != 0) {
$ionicTabsDelegate.select(selected - 1);
}
}
$scope.go = function(state) {
$state.go(state);
}
$scope.destroySession = function() {
AuthService.logout();
};


// Get cities by state
$scope.getCities = function(mystate) {
$scope.citiesByState = [];
$scope.arr = [];
for (var i = 0; i < $scope.cities.length; i++) {
if ($scope.cities[i].stateID == mystate) {
$scope.arr.push($scope.cities[i]);
}
}
$scope.citiesByState = $scope.arr;
}


})

最佳答案

哦,我的上帝。经过几天的努力,终于找到了解决方案。
我正在使用默认功能参数。 ES6/ES2015 支持此功能。当我使用以下语法时:

$scope.showActionSheet = function(indexPic = false, width = 500, height = 500, allowEdit = true) {
}

ios 9可能不支持此功能。

关于ionic-framework - ionic ios9错误: [ng:areq] Argument ‘TabCtrl’ is not a function, got undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40425070/

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