Skip to content

Configuration block with strictDi #136

@nero120

Description

@nero120

Thank you for this library, it's working great except I have one issue that I just can't figure out. I'm defining a configuration block in a module and need to inject a provider, and I have strictDi enabled:

@NgModule({
  id: 'AppModule'
})
export default class AppModule {
  static config($compileProvider: ng.ICompileProvider) {
    $compileProvider.debugInfoEnabled(false);
  }
}

Obviously I get an error if I try to run this as-is:

Error: [$injector:strictdi] config is not using explicit annotation and cannot be invoked in strict mode

So my question is how can I annotate this function explicitly if I'm using the @NgModule decorator? Also worth mentioning, I am not use any 'ng-annotate' fork since I couldn't get it to work so for now I'm defining $inject to support strictDi for my components, but obviously I can't do the same for the config function. Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions