作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我仅在 ios 9中收到此错误。在ios 10
和android
和浏览器中正常工作。我真的不明白为什么仅在 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) {
}
关于ionic-framework - ionic ios9错误: [ng:areq] Argument ‘TabCtrl’ is not a function, got undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40425070/
我有一个对话框 (CDialog),其中包含所有者绘制的 CTabCtrl。选项卡内容是子对话框(每个选项卡一个)。每个选项卡中都有一个 CEdit。当用户单击一个选项卡时,我将使用 ShowWind
我仅在 ios 9中收到此错误。在ios 10和android和浏览器中正常工作。我真的不明白为什么仅在 ios 9 中会发生这种情况 注意:当我清洁contoller内的代码时,可以正常工作。 我的
我是一名优秀的程序员,十分优秀!