angular-ui / ui-router

The de-facto solution to flexible routing with nested views in AngularJS
http://ui-router.github.io/
MIT License
13.56k stars 3.01k forks source link

ui-router won't honer strictDi for resolves under angular 1.4 #3678

Closed tomyam1 closed 6 years ago

tomyam1 commented 6 years ago

This is a (check one box):

My version of UI-Router is: 1.0.15

Bug Report

ui-router won't force strictDi when for resolves when running under angular 1.4

Expected Behavior:

ui-router

Link to Plunker or stackblitz that reproduces the issue:

https://plnkr.co/edit/zvCnOAJJMEOfglpgpcG3?p=preview

Click on the "Home" link and see that the state resolves correctly using the "noDeps" resolve which has no strictDi.

When running using angular 1.5.11 / 1.6.9 it throws correctly:

angular.js:68 Uncaught Error: [$injector:strictdi] noDeps is not using explicit annotation and cannot be invoked in strict mode
http://errors.angularjs.org/1.5.11/$injector/strictdi?p0=noDeps
    at VM5048 angular.js:68
    at Object.annotate (VM5048 angular.js:4005)
    at VM4917 angular-ui-router.js:8782
    at Array.forEach (<anonymous>)
    at runBlock (VM4917 angular-ui-router.js:8782)
    at Object.invoke (VM5048 angular.js:4771)
    at VM5048 angular.js:4578
    at forEach (VM5048 angular.js:325)
    at createInjector (VM5048 angular.js:4578)
    at doBootstrap (VM5048 angular.js:1809)

This seems to happen because you use the .strictDi property to test if an injector user strict DI. But it was added on 1.5

christopherthielen commented 6 years ago

Thanks for the nice bug report. This will be fixed in the next release.

https://next.plnkr.co/edit/tXMB99ECUMJz0mhk