christopherthielen / ui-router-extras

THIS PROJECT IS NO LONGER MAINTAINED -- Extras for UI-Router for AngularJS. Sticky States (a.k.a. parallel states), Deep State Redirect (for tab-like navigation), Future States (async state definition)
http://christopherthielen.github.io/ui-router-extras/
MIT License
917 stars 211 forks source link

Angular 1.6, "Error: transition prevented" #356

Open exchsac opened 7 years ago

exchsac commented 7 years ago

Since the angular 1.6.x releases dsr still seems to work but I get a nasty console message : http://codepen.io/exchsac/pen/jVjGBJ

"Error: transition prevented $get@https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.3.2/angular-ui-router.js:2912:75 invoke@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.js:4842:24 $get@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.js:4709:49 invoke@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.js:4842:24 $get@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.js:4709:49 invoke@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.js:4842:24 $get@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.js:4709:49 invoke@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.js:4842:24 https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.js:4636:43 getService@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.js:4783:39 https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.3.2/angular-ui-router.js:3696:20 invoke@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.js:4842:24 https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.js:4645:68 forEach@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.js:357:24 createInjector@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.js:4645:10 doBootstrap@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.js:1838:34 bootstrap@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.js:1859:23 angularInit@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.js:1744:14 https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.js:32977:16 trigger@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.js:3314:7" "Possibly unhandled rejection: {'line':2912,'column':75,'sourceURL':'https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.3.2/angular-ui-router.js'}"

liangtongxie commented 7 years ago

i also have this problem....

chris-eaton commented 7 years ago

If you upgrade to version UI Router 0.3.2 it fixed this for me

gigmaps commented 7 years ago

yes see issue #354 and pull request #355 due to an outdated bower.json ui-router-extras currently limits ui-router to version 0.2.18 @christopherthielen could you please have a look at PR #355 to get this sorted ?

exchsac commented 7 years ago

hmm... the example provided does use angular-ui-router v0.3.2 (look at the error message I pasted, second and last line), I don't see how bower.json is relevant here (btw. wouldn't the next ui-router-extras release be >0.1.3 ?).

nijat12 commented 7 years ago

+1

BeerPoldet commented 7 years ago

I'm also get this error. Does this matter? Can i just ignore it?

anzorb commented 7 years ago

Getting this error with the following setup:

├── angular#1.6.1
├── angular-ui-router#0.3.2
├── ui-router-extras#0.1.3
nick-adriaenssens commented 7 years ago

+1

BjornRombaut commented 7 years ago

We are also experiencing the same problem using:

├── angular@1.6.1 
├── angular-ui-router@0.3.2 
└── ui-router-extras@0.1.3 
BjornRombaut commented 7 years ago

@christopherthielen I created a PR that resolves this issue, Im not 100% sure that it is the correct solution. Can you check and give feedback? Thanks

thinkdj commented 7 years ago

Use the latest version and it will be gone. I had the same problem and spent time figuring out what I did wrong. Thanks, @chris-eaton for the direction.

goleafs commented 7 years ago

the error is not gone if you are using ct-ui-router-extras, at least in some circumstances.

however, I found making this change in ct-ui-router-extras resolves it... but I am not sure what other implication this may have.

any idea? @christopherthielen?
line 1211 - changed as follows...

                    //return $q.reject(err);
                    return err;
krimark commented 7 years ago

Can confirm that using ct-ui-router-extras 0.1.3 together with ui-router 0.4.2 and angular 1.6.1 causes this. I was going nuts trying to find out what was causing it, thank's for spotting it goleafs. Removing return $q.reject(err); also seems to do the trick for me.

N0NamedGuy commented 7 years ago

I figured out that this happens because of this: https://github.com/angular/angular.js/issues/14631

Another workaround, to restore the old behaviour (while a fix lands on ui-router-extras) is to disable the reporting of unhandled rejections, by setting this on a config block, on your applications:

angular.module('myapp').config(function ()
  // Disable reporting of unhandled rejections
  $qProvider.errorOnUnhandledRejections(false);
});

This is just a band-aid!

https://docs.angularjs.org/api/ng/provider/$qProvider

Delan60 commented 7 years ago

+1

renandegrandi commented 7 years ago

i have the same problem

Angular 1.6.4 ui.router 0.4.2 ui-router-extras 0.1.3

fborges42 commented 6 years ago

got this problem also... angular v1.6.7 ui-router v1.0.5 no ui-router-extras

$qProvider.errorOnUnhandledRejections(false); is not working in my case..

Edit: Ended up correcting the problem. I was using the popover directive from angular-ui-bootstrap 0.13.3 (totally deprecated) with popover-popup-delay wich was causing the problem. Solution: Upgrade library or control timeout from the controller.

aaronpikkarainen commented 6 years ago

I found that the below work around has a bad side-effect where real javascript errors are sometimes not making it to the console. This means silent errors can happen (yikes!).

$qProvider.errorOnUnhandledRejections(false);

Does anyone have a better, trusted solution that removes the "transition prevented" error message, but doesn't affect other errors?

tracyalison11 commented 6 years ago

I had all these same errors and attempted to fix by updating. My issue was resolved by removing a $location.hash statement in my controller.

DavideCordella commented 5 years ago

Anybody managed to fix the issue without other updates? I have the following configuration: ├── angular@1.6.9 ├── angular-ui-router@0.4.2 └── ui-router-extras@0.1.3

aaronpikkarainen commented 5 years ago

I found that I could fix the issue with a small change to ct-ui-router-extras.dsr.js (see attached screen shot). The idea came from this similar fix from Christopher -> https://github.com/angular-ui/ui-router/commit/66ab048bb18e1412f080f63abc4528ee3439b356 code change