Skip to content

Commit

Permalink
Merge pull request #730 from bezineb5/ts-angular-ModuleWithProviders-fx
Browse files Browse the repository at this point in the history
Templatized ModuleWithProviders in typescript-angular
  • Loading branch information
HugoMario authored Jul 21, 2021
2 parents f3710d3 + 6c08748 commit 78ce303
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ public void processOpts() {
if (!ngVersion.atLeast("4.3.0")) {
supportingFiles.add(new SupportingFile("rxjs-operators.mustache", getIndexDirectory(), "rxjs-operators.ts"));
}

// Version after Angular 10 require ModuleWithProviders to be generic. Compatible from version 7.
if (ngVersion.atLeast("7.0.0")) {
additionalProperties.put("genericModuleWithProviders", true);
}

// for Angular 2 AOT support we will use good-old ngc,
// Angular Package format wasn't invented at this time and building was much more easier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { {{classname}} } from './{{importPath}}';
{{/hasMore}}{{/apis}}{{/apiInfo}} ]
})
export class ApiModule {
public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders {
public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders{{#genericModuleWithProviders}}<ApiModule>{{/genericModuleWithProviders}} {
return {
ngModule: ApiModule,
providers: [ { provide: Configuration, useFactory: configurationFactory } ]
Expand Down

0 comments on commit 78ce303

Please sign in to comment.