问题
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
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('/');
});
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",
}
}
回答1:
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",
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.
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
回答2:
Remove "angular-ui-router": "^0.2.18", from package.json just run command
npm install --save angular-ui-router
来源:https://stackoverflow.com/questions/42442411/error-for-angular-ui-router-transition-superseded-transition-prevented-trans