ionique changement d'emplacement ne fonctionne pas
je suis nouveau dans ionique ( juste un peu moins dans angularjs ) .
je suis en train de faire un simple interrupteur entre les deux points de vue:
HTML
<body ng-app="starter" animation="slide-left-right-ios7">
<!--
The nav bar that will be updated as we navigate between views.
-->
<ion-nav-bar class="bar-stable nav-title-slide-ios7">
<ion-nav-back-button class="button-icon icon ion-ios7-arrow-back">
Back
</ion-nav-back-button>
</ion-nav-bar>
<ion-nav-view name="intro"></ion-nav-view>
<ion-nav-view name="login"></ion-nav-view>
<ion-nav-view name="home"></ion-nav-view>
<ion-nav-view name="pizze"></ion-nav-view>
<ion-nav-view name="sponsor"></ion-nav-view>
<ion-nav-view name="scontrino"></ion-nav-view>
</body>
APP.js
.config(function($stateProvider, $urlRouterProvider) {
//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
.state('intro', {
url: '/intro',
views: {
'intro': {
templateUrl: 'templates/intro.html',
controller: 'IntroCtrl'
}
}
})
.state('login', {
url: '/login',
views: {
'login': {
templateUrl: 'templates/login.html',
controller: 'LoginCtrl'
}
}
})
$urlRouterProvider.otherwise('/intro');
});
Controllers.js
angular.module('starter.controllers', [])
.controller('IntroCtrl', function($scope,$location) {
$location.url("/login");
})
.controller('LoginCtrl', function($scope,$location) {
})
Intro est affichée correctement, mais quand il essaie de changer de lieu de "login.html" il dit:
TypeError: Cannot read property 'querySelectorAll' of undefined
at cancelChildAnimations (http://localhost:8000/www/lib/ionic/js/ionic.bundle.js:30611:21)
at Object.leave (http://localhost:8000/www/lib/ionic/js/ionic.bundle.js:30176:11)
at Object.leave (http://localhost:8000/www/lib/ionic/js/ionic.bundle.js:38411:24)
at updateView (http://localhost:8000/www/lib/ionic/js/ionic.bundle.js:41540:31)
at eventHook (http://localhost:8000/www/lib/ionic/js/ionic.bundle.js:41501:17)
at Scope.$broadcast (http://localhost:8000/www/lib/ionic/js/ionic.bundle.js:21190:28)
at $state.transition.resolved.then.$state.transition (http://localhost:8000/www/lib/ionic/js/ionic.bundle.js:33975:22)
at wrappedCallback (http://localhost:8000/www/lib/ionic/js/ionic.bundle.js:19894:81)
at http://localhost:8000/www/lib/ionic/js/ionic.bundle.js:19980:26
at Scope.$eval (http://localhost:8000/www/lib/ionic/js/ionic.bundle.js:20906:28)
Quel pourrait être le problème???
Merci!
OriginalL'auteur JackTurky | 2014-05-29
Vous devez vous connecter pour publier un commentaire.
Essayer cette
Où puis-je trouver des docs sur le
$state
service?OriginalL'auteur Mathews
Vous utilisez des noms de vue erroné.
Dans un état, la vue du nom de
est utilisé pour la navigation différentes histoires de différents points de vue.
Dire que vous avez deux onglets,
home
etpizza
, et vous souhaitez à la fois d'avoir plusieurs pages, puis le nom de la vue est très pratique.Pour votre exemple, il est important de savoir, comment vous voulez le point de vue à être utilisé.
- Je configurer un exemple pour vous, faisant le point de vue accessibles par des onglets.
Voir ici pour l'exemple: http://plnkr.co/edit/Yd5ehQd0wnwlPzP0KYnp?p=preview
OriginalL'auteur Clawish