ui-router-extras icon indicating copy to clipboard operation
ui-router-extras copied to clipboard

Angular 1.6, "Error: transition prevented"

Open exchsac opened this issue 8 years ago • 21 comments

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'}"

exchsac avatar Dec 27 '16 17:12 exchsac

i also have this problem....

liangtongxie avatar Dec 30 '16 08:12 liangtongxie

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

chris-eaton avatar Jan 04 '17 09:01 chris-eaton

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 ?

gigmaps avatar Jan 06 '17 18:01 gigmaps

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 ?).

exchsac avatar Jan 06 '17 18:01 exchsac

+1

nijat12 avatar Jan 06 '17 20:01 nijat12

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

BeerPoldet avatar Jan 11 '17 07:01 BeerPoldet

Getting this error with the following setup:

├── angular#1.6.1
├── angular-ui-router#0.3.2
├── ui-router-extras#0.1.3

anzorb avatar Jan 14 '17 23:01 anzorb

+1

nick-adriaenssens avatar Jan 17 '17 08:01 nick-adriaenssens

We are also experiencing the same problem using:

├── [email protected] 
├── [email protected] 
└── [email protected] 

BjornRombaut avatar Jan 17 '17 09:01 BjornRombaut

@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

BjornRombaut avatar Jan 18 '17 07:01 BjornRombaut

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.

thinkdj avatar Jan 26 '17 11:01 thinkdj

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;

goleafs avatar Feb 03 '17 19:02 goleafs

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.

krimark avatar Feb 03 '17 23:02 krimark

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

N0NamedGuy avatar Feb 07 '17 15:02 N0NamedGuy

+1

Delan60 avatar Mar 16 '17 14:03 Delan60

i have the same problem

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

renandegrandi avatar May 02 '17 16:05 renandegrandi

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.

fborges42 avatar Jul 26 '17 09:07 fborges42

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?

aaronpikkarainen avatar Aug 24 '17 20:08 aaronpikkarainen

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.

tracyalison11 avatar Oct 06 '17 16:10 tracyalison11

Anybody managed to fix the issue without other updates? I have the following configuration: ├── [email protected] ├── [email protected] └── [email protected]

DavideCordella avatar Jan 07 '19 16:01 DavideCordella

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

aaronpikkarainen avatar Jan 11 '19 18:01 aaronpikkarainen