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.

Should $injector#annotate consider the injector's own strictDi option? #12446

Closed
@marcioj

Description

@marcioj

For instance:

injector = angular.injector(['ng'], true); // true means use strict-di
function foo($rootScope) {}
injector.invoke(foo); // correctly throws Error: [$injector:strictdi] 
injector.instantiate(foo); // correctly throws Error: [$injector:strictdi] 
injector.annotate(foo); // ["$rootScope"]

In the last example, I also expected an Error: [$injector:strictdi] but this option is just ignored and the function is annotated.
Using injector.annotate(foo, true); make the error threw, but in this case we are duplicating the option, and also there is situations where annotate is being used by some third party library and we cannot control this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions