url改变模板不加载离子框架

时间:2015-05-25 10:41:17

标签: angularjs ionic-framework ionic

我无法从一个页面重定向到另一个页面。

我可以从Splashscreen路由到话题屏幕,但是当我从主题调用splashScreen时,我的控制器会执行,但是模板不能再次加载。 该怎么办.. 我正在使用$state.go('topicScreen');从一个页面重定向到另一个页面。 我能够按照配置中的定义转到最低网址。

在Android设备中运行时出现此错误

W/BindingManager Cannot call determined Visibility() - never saw a connection for the

我的配置

ionicApp.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('splashScreen', {
    cache: false,
    url: '/splashScreen',
    views: {
      'splashScreen': {      
        templateUrl: 'templates/splashScreen.html',
        controller: 'SplashScreenCtrl'
      }
    }
  }).state('topicScreen', {
    cache: false,
    url: '/topicScreen',
    views: {
      'topicScreen': {
        templateUrl: 'templates/topicScreen.html',
        controller: 'GridController'
      }
    }
  }).state('questionList', {
    cache: false,
    url: '/topicScreen/:id/:description/:icon/questionList',
    views: {
      'questionList': {
        templateUrl: 'templates/questionList.html',
        controller: 'QuesController'
      }
    }
  }).state('answerPage', {
    cache: false,
    url: '/topicScreen/:category_id/:id/answerPage',
    views: {
      'questionList': {
        templateUrl: 'templates/answerPage.html',
        controller: 'AnsController'
      }
    }
  }).state('costumQues', {
    cache: false,
    url: '/costumQues/:category_id',
    views: {
      'costumQues': {
        templateUrl: 'templates/costumQues.html',
        controller: 'CostomQuesController'
      }
    }
  });
  // if none of the above states are matched, use this as the fallback
  $urlRouterProvider.otherwise('/splashScreen');

});

我的Index.html

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
        <link href="lib/ionic/css/ionic.css" rel="stylesheet">
        <link href="css/style.css" rel="stylesheet">
        <script src="lib/ionic/js/ionic.bundle.js"></script>
        <script src="js/ng-cordova.min.js"></script>
        <script src="cordova.js"></script>
        <script src="js/app.js"></script>
        <script src="js/controllers.js"></script>
        <script src="js/dbServices.js"></script>
        <link href="http://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic" rel="stylesheet" type="text/css">
    </head>
    <body ng-app="starter">
      <ion-nav-view name="splashScreen"></ion-nav-view>
      <ion-nav-view name="topicScreen"></ion-nav-view>
      <ion-nav-view name="questionList"></ion-nav-view>
      <ion-nav-view name="answerPage"></ion-nav-view>
      <ion-nav-view name="costumQues"></ion-nav-view>

    </body>
</html>

2 个答案:

答案 0 :(得分:0)

在角度方面,我使用了 ,这对我有用

$routeProvider.when('/sales', {
    templateUrl : 'sales.html',
    controller : 'salesCtrl'

})

答案 1 :(得分:0)

在你的html文件中只尝试这个:

<body ng-app="starter">
    <ion-nav-view ></ion-nav-view>
</body>