Android 4.2.2 ionicAuth.signup help


#1

Hello guys. When i run app in my Android 4.2.2 i got bug, APP lag in home and dont work.

ProfKamaz.controller('home', [
	'$scope',
	'$ionicPush',
	'$ionicAuth',
	'$ionicPopup',
	'$ionicHistory',
	'$state',
	'$http',
	'$window',
	'serverService',
	function($scope, $ionicPush, $ionicAuth, $ionicPopup, $ionicHistory, $state, $http, $window, serverService){


if($window.localStorage.getItem('email_prof') === null){
	$scope.data = {}
      // Custom popup
      var myPopup = $ionicPopup.show({
         template: '<input type = "email" ng-model = "data.model">',
         title: 'Введите E-mail',
         subTitle: 'Для того чтобы пользоватся всеми функциями нашего приложения пожалуйста введите свой E-mail',
         scope: $scope,
			
         buttons: [
            {
               text: '<b>Сохранить</b>',
               type: 'button-positive',
                  onTap: function(e) {
						
                    if (!$scope.data.model) {
                        //don't allow the user to close unless he enters model...
                           e.preventDefault();
						   alert("Введите свой E-mail");
                     } else {
                        return $scope.data.model;
                     }

                  }
            }
         ]
      });

      myPopup.then(function(res) {
         console.log('Tapped!', res);
		 $window.localStorage.setItem('email_prof', res);
		 console.log($window.localStorage.getItem('email_prof'));
		 
		 var details = {'email': res, 'password': 'password'};
		 
		$ionicAuth.signup(details).then(function() {
		// is now registered
		}, function(err) {
		for (var e of err.details) {
			if (e === 'conflict_email') {
			//alert('User already exists');

			$ionicAuth.login('basic', details).then(
				function(loggeduser){
					//alert("logged in");
				}, function(error){
			
				}
			);
	
			} else {
			// handle other errors
			}
		}
		}); 
      });    
}
if($window.localStorage.getItem('email_prof')){
	var details = {'email': $window.localStorage.getItem('email_prof'), 'password': 'password'};
	
	$ionicAuth.login('basic', details).then(
		function(loggeduser){
			//alert("logged in");
		}, function(error){

		}
	);
	
	$ionicPush.register().then(function(t) {
	return $ionicPush.saveToken(t);
	}).then(function(t) {
	//alert('Token saved:', t.token);
	});
}	


$scope.$on('cloud:push:notification', function(event, data) {
  var msg = data.message;
  //alert(msg.title + ': ' + msg.text);
});

	$scope.$on('$ionicView.beforeEnter', function(){
	$scope.home_menu = [
	{ title: 'НОВОСТИ', link: 'razdel_news/5' },
	{ title: 'О ПРОФКОМЕ', link: 'about' },
	{ title: 'ПРЕИМУЩЕСТВА', link: 'preim' },
	{ title: 'КАРТА ЧЛЕНА ПРОФСОЮЗА', link: 'karta' },
	{ title: 'ВИРТУАЛЬНАЯ ПРИЕМНАЯ', link: 'virtual' },
	{ title: 'ЗАДАТЬ ВОПРОС ЮРИСТУ', link: 'question' },
	{ title: 'КОНТАКТЫ', link: 'kontacts' }
	];
  
	$scope.fb = "http://profkamaz.ru/";
	$scope.in = 'https://www.instagram.com/profkomkamaz/';
	$scope.vk = 'https://vk.com/profkomkamaz';
	$scope.tw = "http://profkamaz.ru/";
	$scope.you = "https://www.youtube.com/channel/UCZszRvqcCAqavchoAKNEx2g";
	


        $http.get("http://api.waytrel.pro/security/profkom/index.php")
            .success(function(data) {
                $scope.security = data.security;
				
				if(data.security == "yes"){
					//alert(data.security);
				}else{
					ionic.Platform.exitApp();
				}
            })
            .error(function(data) {
                //alert("ERROR");
            });
    
	});
  
  
		//$scope.$on('$ionicView.beforeEnter', function(){
		//	serverService.getHomeMenu().then(function(data){
		//		$scope.home_menu = data.home_menu;
		//		console.log($scope.home_menu);
		//	});
		//});
   
		//$scope.event = {
        //prizes: [{
        //    name: "name",
        //    description: "description"
        //}, {
        //    name: "name2",
        //    description: "description2"
        //}, {
        //    name: "name3",
        //    description: "description3"
        //}, {
        //    name: "name4",
        //    description: "description4"
        //}]
		//};
}]);


#2

And when i remote code

		 var details = {'email': res, 'password': 'password'};
		 
		$ionicAuth.signup(details).then(function() {
		// is now registered
		}, function(err) {
		for (var e of err.details) {
			if (e === 'conflict_email') {
			//alert('User already exists');

			$ionicAuth.login('basic', details).then(
				function(loggeduser){
					//alert("logged in");
				}, function(error){
			
				}
			);
	
			} else {
			// handle other errors
			}
		}
		}); 

All work fine… help me pleace