离子路由TypeError:$ state。$ current.locals未定义

时间:2017-05-15 13:33:25

标签: angularjs ionic-framework

我有一个问题,我需要在离子中创建路由,所以当我把这样的libs放在那里时

 <script type="text/javascript" src="cordova.js"></script>

<link href="https://cdnjs.cloudflare.com/ajax/libs/ionic/1.3.2/css/ionic.css" rel="stylesheet">

<link rel="stylesheet" href="SRC/Bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="SRC/Bootstrap/css/font-awesome.css" />
<script src="SRC/JQuery/JQuery.js"></script>
<script src="SRC/Bootstrap/js/bootstrap.min.js"></script>



<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.4/angular.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.4/angular-route.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-sanitize/1.6.4/angular-sanitize.js"></script>


<script src="https://cdnjs.cloudflare.com/ajax/libs/ionic/1.3.2/js/ionic.bundle.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ionic/1.3.2/js/ionic.js"></script>
<script src="https://cdn.rawgit.com/zachsoft/Ionic-Material/master/dist/ionic.material.min.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/1.0.3/angular-ui-router.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.4/angular-animate.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.4/angular-aria.js"></script>

<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">


<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.4/angular-resource.js"></script>

我有这个错误

  

TypeError:$ state。$ current.locals未定义

但是当我把我的angular-ui-router放在离子库之前

 <script type="text/javascript" src="cordova.js"></script>

<link href="https://cdnjs.cloudflare.com/ajax/libs/ionic/1.3.2/css/ionic.css" rel="stylesheet">

<link rel="stylesheet" href="SRC/Bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="SRC/Bootstrap/css/font-awesome.css" />
<script src="SRC/JQuery/JQuery.js"></script>
<script src="SRC/Bootstrap/js/bootstrap.min.js"></script>



<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.4/angular.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.4/angular-route.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-sanitize/1.6.4/angular-sanitize.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/1.0.3/angular-ui-router.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/ionic/1.3.2/js/ionic.bundle.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ionic/1.3.2/js/ionic.js"></script>
<script src="https://cdn.rawgit.com/zachsoft/Ionic-Material/master/dist/ionic.material.min.js"></script>



<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.4/angular-animate.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.4/angular-aria.js"></script>

<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">


<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.4/angular-resource.js"></script>

我有这个错误

  

错误:已取代转换   Trace de la pile:   $ GET @ https://cdnjs.cloudflare.com/ajax/libs/ionic/1.3.2/js/ionic.bundle.js:51771:42

     

错误:阻止转换   Trace de la pile:   $ GET @ https://cdnjs.cloudflare.com/ajax/libs/ionic/1.3.2/js/ionic.bundle.js:51772:41

     

错误:转换已中止   Trace de la pile:   $ GET @ https://cdnjs.cloudflare.com/ajax/libs/ionic/1.3.2/js/ionic.bundle.js:51773:39

     

错误:转换失败   Trace de la pile:   $ GET @ https://cdnjs.cloudflare.com/ajax/libs/ionic/1.3.2/js/ionic.bundle.js:51774:38

所以我必须把我的lib?

这是我的简单路线

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

        $stateProvider
            .state('app', {
                url: '/app',
                templateUrl: 'Template/side-menu-template.html',
                abstract: true
            });

        $urlRouterProvider.otherwise('/app');


    });

HTML

<ion-nav-view ></ion-nav-view>

如果有人可以帮助我

提前致谢

1 个答案:

答案 0 :(得分:0)

I am facing the same issue. I could not figure out the proper fix (seems to do something with library versions incompatibility).

As a workaround I have replaced

<ion-nav-view ></ion-nav-view> 

with

<div ui-view> </div>