Javascript TypeError:无法读取属性';然后';未定义的角度:11592
我正在使用ionic并在选项卡之间切换时收到此错误消息: 该错误仅在切换选项卡时发生,我不知道它可能来自何处:Javascript TypeError:无法读取属性';然后';未定义的角度:11592,javascript,angularjs,ngroute,route-provider,ionic,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
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
我真的希望你能找到任何东西,或者至少给我一个去哪里看的线索
谢谢!:) .那么这只是一种承诺的功能。因此,在代码中的某个地方,您有一个承诺,但在任何时候,承诺都是未定义的。您可以在plunker中复制吗?您实际上不调用
。然后在您提供的代码中调用。请提供更多的相关代码。你能显示标签的HTML吗?我也不知道与之相关的是什么。这是我的报告,也许这有助于更深入地了解它。
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);
});