ионное приложение работает в браузере, но не работает на устройстве

0

Простая навигация от входа в другое состояние работает в браузере, но взламывает Android-устройство, любая идея в такой ситуации, что я проверяю? потому что у меня нет ошибок в браузере, и у меня нет журнала при работе на устройстве, так как я отлаживаю?

app.js:
=======

// Ionic Starter App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'

var ionicApp = angular.module('feedback-system', ['ionic', 'firebase', 'coursesModule', 'feedbackModule', 'loginModule', 'servicesModule', 'tabsModule', 'notificationModule', 'addCoursesModule']);

ionicApp.run(function($ionicPlatform, $state, $location, $rootScope, $localstorage) {
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if(window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
    }
    if(window.StatusBar) {
      StatusBar.styleDefault();
    }
  });

  $rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams)
  {

    if($localstorage.get('login') == 'false')
    {
      $location.path('/login');
      // $state.go('login');
    }
  });
});


ionicApp.config(function($stateProvider, $urlRouterProvider) {
  $stateProvider

  .state('login', {
    url: '/login',
    templateUrl: 'views/login.html',
    controller: 'loginCtrl'
  })

  .state('tabs', {
    url: '/tabs',
    abstract: true,
    templateUrl: 'views/main.html',
    controller: 'tabsCtrl'
  })

  .state('tabs.courses', {
    url: '/courses',
    views:{
      'coursesView':{    
        templateUrl: 'views/courses.html',
        controller: 'coursesCtrl'
      }
    }
  })
  .state('tabs.feedback', {
    url: '/feedback',
    views:{
      'feedbackView':{
        templateUrl: 'views/feedback.html',
        controller: 'feedbackCtrl'
      }
    }
  })

  .state('tabs.notifications', {
    url: '/notifications',
    views:{
      'notificationsView':{
        templateUrl: 'views/notification.html',
        controller: 'notificationCtrl'
      }
    }
  })

  $urlRouterProvider.otherwise("/tabs/courses");

});

Сервисы:

var servicesModule = angular.module('servicesModule', ['ionic', 'ngCordova']);

servicesModule.factory('$localstorage', ['$window', function($window) {
  return {
    set: function(key, value) {
      $window.localStorage[key] = value;
    },
    get: function(key) {
      return $window.localStorage[key] || undefined;
    },
    setObject: function(key, value) {
      $window.localStorage[key] = JSON.stringify(value);
    },
    getObject: function(key) {
      return JSON.parse($window.localStorage[key] || '{}');
    }
  }
}]);


servicesModule.service('firebaseReferenceService', ['$state', function($state){
    var ref = new Firebase("https://feedback-system.firebaseio.com/");
    return {firebaseMainAppObjectReference: ref};
}]);

servicesModule.service('loginService', ['$state', '$localstorage', function($state, $localstorage){

    var ref = new Firebase("https://feedback-system.firebaseio.com/");
    var authData = ref.getAuth();

    if (authData) {

        $localstorage.set('login', 'true');

      $state.go('tabs.courses');
      console.log("User " + authData.uid + " is logged in with " + authData.provider);

    } else {

      $state.go('login');
    }

}]);


servicesModule.service('usernameParsingService' , ['$state', '$localstorage', function($state, $localstorage){

    var ref = new Firebase("https://feedback-system.firebaseio.com/");
    var authData = ref.getAuth();
    var userauthen = authData.uid;
    var emailid = authData.password.email.replace(/@.*/,'');

    var completeemail = authData.password.email;

    var stuOrAd = completeemail.includes("student");

    var ln = userauthen.length;

    userauthen = emailid + userauthen.charAt(ln-1);

    var str = userauthen.split(".");

    userauthen = "";
    for (i=0; i<str.length; i++)
    {
      userauthen = userauthen + str[i];
    }

    console.log('stuOrAd : ' + stuOrAd);
    console.log('userauthen : ' + userauthen);

    return {userid: userauthen ,
            checker: stuOrAd};

}]);
Теги:
ionic-framework
cordova
ionic

1 ответ

1

Однажды я получил такую ошибку.

Все имена состояний, имена папок и страницы чувствительны к регистру. Вы должны проверить имена состояний, папок или имен страниц ("Столичные" или "Маленькие буквы").

Он работает в браузере, но при развертывании на устройстве он не работает.

Надеюсь, это поможет

  • 0
    я также нашел, как отладить устройство в Chrome, спасибо
  • 0
    Хорошо ... хорошо ... Но в чем была проблема в вашем случае?

Ещё вопросы

Сообщество Overcoder
Наверх
Меню