Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Add isStrictDi to $injector #11728

Closed
Closed
@kentcdodds

Description

@kentcdodds

I'm writing a utility library where I have a use case to know when strict DI is enabled on a given $injector. I could really use some reasonable way of knowing without having to do something crazy like:

function isStrictDi($injector) {
  try {
    $injector.invoke(function(a) {});
    return false;
  } catch(e) {
    return true;
  }
}

I'm thinking that we could just add a line that says instanceInjector.strictDi = strictDi right here before the instanceInjector is returned.

I would happily open a PR with tests which would do this. Just want to make sure this is the correct approach.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions