角度 ui-router 转换的错误被取代/转换被阻止/转换中止/转换失败 [英] Error for angular ui-router transition superseded / transition prevented / transition aborted / transition failed

查看:20
本文介绍了角度 ui-router 转换的错误被取代/转换被阻止/转换中止/转换失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到错误:错误:转换被取代在 $StateProvider.$get (http:///localhost:1337/angular-ui-router/release/angular-ui-router.js:2903:42)

Im getting the errors: Error: transition superseded at $StateProvider.$get (http://localhost:1337/angular-ui-router/release/angular-ui-router.js:2903:42)

错误:转换被阻止错误:转换中止错误:转换失败

Error: transition prevented Error: transition aborted Error: transition failed

我发现了一个类似的帖子,他建议的解决方案是将 angular-ui-router 更新到 0.3.1,但是当我更新它时,它只更新到 0.2.18 版,我查看了有关 0.2 的文档.18,所以我有点困惑.我在网上找不到其他任何东西,希望有人有想法,因为我不知道为什么我会收到这些错误.谢谢!

I found a similar post where he suggested solution is to update angular-ui-router to 0.3.1 however when I update it, it is being updated only to version 0.2.18, i checked the documentation which speaks about 0.2.18 as well so Im a little confused. I couldnt find anything else online and hope someone has an idea as I have no clue why Im getting those errors. Thanks!

<!DOCTYPE html>
<html lang="en">

<head>
    <base href="/" />
    <title>An app</title>
    <link rel="stylesheet" type="text/css" href="/bootstrap/dist/css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="/style.css" />
    <link rel="stylesheet" href="/materialize-css/bin/materialize.css">
    <script src="/lodash/index.js"></script>
    <script type="text/javascript" src="/jquery/dist/jquery.min.js"></script>

    <script src="/angular/angular.js"></script>
    <script src="/angular-animate/angular-animate.js"></script>
    <script src="/angular-ui-router/release/angular-ui-router.js"></script>
    <script src="/angular-ui-router-styles/ui-router-styles.js"></script>
    <script type="text/javascript" src="/materialize-css/bin/materialize.js"></script>

    <script src="/angular-ui-bootstrap/ui-bootstrap.js"></script>
    <script src="/angular-ui-bootstrap/ui-bootstrap-tpls.js"></script>
    <script src="/socket.io-client/socket.io.js"></script>
    <script src="/main.js"></script>
</head>

<body ng-app="myApp">
    <navbar></navbar>
    <div id="main" ui-view></div>
</body>

</html>

app.js

window.app = angular.module('myapp', ['ui.router', 'ui.bootstrap', 'ngAnimate']);

app.config(function ($urlRouterProvider, $locationProvider) {
    $locationProvider.html5Mode(true);
    $urlRouterProvider.otherwise('/');  
});

package.json 的一部分

part of package.json

},
  "engines": {
    "node": ">=4.0.0"
  },
  "dependencies": {
    "angular": "^1.6.2",
    "angular-animate": "^1.6.2",
    "angular-mocks": "^1.4.0",
    "angular-ui-bootstrap": "^0.14.3",
    "angular-ui-router": "^0.2.18",
    "babel-preset-es2015": "^6.6.0",
    "babel-register": "^6.6.0",
    "bluebird": "^3.4.7",
    "body-parser": "^1.12.0",
    "bootstrap": "^3.3.7",
    "chalk": "^1.0.0",
    "connect-session-sequelize": "^3.0.0",
    "cookie-parser": "^1.3.4",
    "express": "^4.12.0",
    "express-session": "^1.10.3",
    "gulp": "^3.8.11",
    "gulp-babel": "^6.1.2",
    "gulp-concat": "^2.5.2",
    "gulp-eslint": "^0.14.0",
    "gulp-istanbul": "^0.9.0",
    "gulp-livereload": "^3.7.0",
    "gulp-minify-css": "^0.4.6",
    "gulp-mocha": "^2.0.0",
    "gulp-ng-annotate": "^0.5.2",
    "gulp-notify": "^2.2.0",
    "gulp-plumber": "^0.6.6",
    "gulp-rename": "^1.2.0",
    "gulp-sass": "^2.0.4",
    "gulp-sourcemaps": "^1.3.0",
    "gulp-uglify": "^1.1.0",
    "jquery": "^3.1.1",
    "lodash": "^3.9.3",
    "materialize-css": "^0.98.0",
    "nodemon": "^1.3.7",
    "passport": "^0.2.1",
    "passport-local": "^1.0.0",
    "pg": "^4.5.5",
    "pg-hstore": "^2.3.2",
    "run-sequence": "^1.0.2",
    "sequelize": "^3.23.3",
    "socket.io": "^1.3.4",
    "socket.io-client": "^1.3.5",
  }
}

推荐答案

当新的 ui-router 出现时,为什么要使用旧版本的 ui-router.你有没有试过:

Why using an old version of ui-router when the new one is out there. Have you tried with :

"angular-ui-router": "1.0.0-rc.1",

如果这不起作用,我们需要有关您的问题的更多信息,也许是显示问题的plunker,仅凭您提供的代码,很难告诉您出了什么问题.

After if that doesn't work, we need more information on your problem, maybe a plunker that shows the problem, with just the code you provided, it's hard to tell you what's wrong.

还有一点与您的问题无关,我建议您将依赖项和 devDependencies 之间的依赖项分开.请参阅此处了解更多详情

Also on a side note that has nothing to do with your questions, I advise you to separate your dependencies between dependencies and devDependencies. See here for more details

这篇关于角度 ui-router 转换的错误被取代/转换被阻止/转换中止/转换失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆