Skip to content

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

Closed
@tomyam1

Description

@tomyam1

This is a (check one box):

  • Bug Report
  • Feature Request
  • General Query

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions