在AngularJS的离子框架中使用ui-router

 vipB时代_959 发布于 2023-01-17 10:26

我正在开发一个使用离子框架的应用程序.这又使用了ui-router.目前,我有一个非常基本的两页应用程序.但是,它会扩大到更大.这时,当我从第一个视图转换到第二个视图时,出现错误.错误说:

TypeError: Cannot read property '1' of null
    at http://localhost:11000/vendor/ionic/release/js/ionic.bundle.js:14235:28
    at updateView (http://localhost:11000/vendor/ionic/release/js/ionic.bundle.js:37839:30)
    at eventHook (http://localhost:11000/vendor/ionic/release/js/ionic.bundle.js:37786:17)
    at Scope.$broadcast (http://localhost:11000/vendor/ionic/release/js/ionic.bundle.js:19725:28)
    at $state.transition.resolved.then.$state.transition (http://localhost:11000/vendor/ionic/release/js/ionic.bundle.js:31686:22)
    at wrappedCallback (http://localhost:11000/vendor/ionic/release/js/ionic.bundle.js:18429:81)
    at http://localhost:11000/vendor/ionic/release/js/ionic.bundle.js:18515:26
    at Scope.$eval (http://localhost:11000/vendor/ionic/release/js/ionic.bundle.js:19441:28)
    at Scope.$digest (http://localhost:11000/vendor/ionic/release/js/ionic.bundle.js:19267:31)
    at Scope.$apply (http://localhost:11000/vendor/ionic/release/js/ionic.bundle.js:19547:24) 

我正在使用Ionic Framework的1.0.0 beta 3.我的app.js文件如下所示:

"use strict";

var myApp = angular.module('myApp', ['ionic', 'ngRoute']);

myApp.config(function($stateProvider, $urlRouterProvider) {
  $stateProvider
    .state('intro', { url: '/', templateUrl: 'app/account/welcome.html', controller: 'WelcomeController' })
    .state('login', { url: '/account/login', templateUrl: 'app/account/login.html', controller: 'LoginController '})
  ;

  $urlRouterProvider.otherwise("/");
});

function WelcomeController($scope) {
}

function LoginController($scope) {
}

我的index.html看起来像这样:




    
    
    

    
    

    
    


    
        
        

        

MyApp

welcome.html看起来像这样:


  

Welcome

Login

login.html看起来像这样:


  

Login

视图转换得很好.但是,我上面显示的错误令我担忧.我害怕以后它会咬我的屁股.有谁知道会造成什么?有谁知道我怎么解决这个问题?

谢谢!

1 个回答
  • 如果您使用bundle ionic.js文件,则不需要包含ui-router,它已包含在内.您也不需要包含ng-router.

    继承人

    2023-01-17 10:27 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有