TypeError:无法读取属性'然后'未定义的angularjs:11592

时间:2014-12-17 17:36:44

标签: javascript angularjs ngroute route-provider ionic

我正在使用ionic并在我的标签之间切换时收到此错误消息: 只有在切换选项卡时才会出现错误,我不知道它可能来自哪里:

 TypeError: Cannot read property 'then' of undefined
    at Object.ngIfWatchAction [as fn] (http://localhost:8100/lib/angular/angular.js:23476:47)
    at Scope.$digest (http://localhost:8100/lib/angular/angular.js:14223:29)
    at Scope.$apply (http://localhost:8100/lib/angular/angular.js:14486:24)
    at HTMLAnchorElement.<anonymous> (http://localhost:8100/lib/ionic/release/js/ionic-angular.js:8873:20)
    at HTMLAnchorElement.eventHandler (http://localhost:8100/lib/angular/angular.js:3009:21)
    at triggerMouseEvent (http://localhost:8100/lib/ionic/release/js/ionic.js:2641:7)
    at tapClick (http://localhost:8100/lib/ionic/release/js/ionic.js:2630:3)
    at HTMLDocument.tapMouseUp (http://localhost:8100/lib/ionic/release/js/ionic.js:2700:5)angular.js:11592 (anonymous function)angular.js:8542 (anonymous function)angular.js:14241 Scope.$digestangular.js:14486 Scope.$applyionic-angular.js:8873 (anonymous function)angular.js:3009 eventHandlerionic.js:2641 triggerMouseEventionic.js:2630 tapClickionic.js:2700 tapMouseUp

我认为它可能与我的app.js有关,我处理路由:

angular.module('starter', ['ionic', 'ngAnimate', 'home', 'play', 'settings', 'chatMaster', 'registration', 'login', 'angular.css.injector', 'map', 'coins'])

.run(function ($ionicPlatform) {
    $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) {
            // org.apache.cordova.statusbar required
            StatusBar.styleDefault();
        }
    });
})

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

    // Ionic uses AngularUI Router which uses the concept of states
    // Learn more here: https://github.com/angular-ui/ui-router
    // Set up the various states which the app can be in.
    // Each state's controller can be found in controllers.js
    $stateProvider

    // setup an abstract state for the tabs directive
    .state('tab', {
        url: "/tab",
        abstract: true,
        templateUrl: "templates/tabs.html"
    })

    .state('login', {
        url: "/login",
        templateUrl: "templates/login.html",
        data: {
            css: 'styles/login.css'
        }
    })

    .state('registration', {
        url: "/registration",
        templateUrl: "templates/registration.html",
    })

    // Each tab has its own nav history stack:

    .state('tab.home', {
        url: '/home',
        views: {
            'tab-home': {
                templateUrl: 'templates/tab-home.html',
                controller: 'homeCtrl'
            }
        }
    })

    .state('tab.play-screen', {
        url: '/play-screen',
        views: {
            'tab-home': {
                templateUrl: 'templates/play-screen.html',
                controller: 'playCtrl',
            }
        }
    })

    .state('tab.map', {
        url: '/play-screen/map',
        views: {
            'tab-home': {
                templateUrl: 'templates/map.html',
                controller: 'mapCtrl'
            }

        }
    })

    .state('tab.chat-master', {
        url: '/chat-master',
        views: {
            'tab-chat-master': {
                templateUrl: 'templates/tab-chat-master.html',
                controller: 'chatMasterCtrl'
            }
        }
    })

    .state('tab.coins', {
        url: '/coins',
        views: {
            'tab-coins': {
                templateUrl: 'templates/tab-coins.html',
                controller: 'coinsCtrl'
            }
        }
    })

    .state('tab.settings', {
        url: '/settings',
        views: {
            'tab-settings': {
                templateUrl: 'templates/tab-settings.html',
                controller: 'settingsCtrl'
            }
        }
    });

    // if none of the above states are matched, use this as the fallback
    $urlRouterProvider.otherwise('login');

    //After a page change all injected CSS files are removed
    cssInjectorProvider.setSinglePageMode(true);
});

我真的希望你能找到任何东西,或者至少给我一个线索。

谢谢! :)

0 个答案:

没有答案