Skip to content

refactor: remove unsupported Angular imports #950

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions src/lazyLoad/lazyLoadNgModule.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NgModuleRef, Injector, NgModuleFactory, Type, Compiler, NgModuleFactoryLoader } from '@angular/core';
import { NgModuleRef, Injector, NgModuleFactory, Type, Compiler } from '@angular/core';
import {
Transition,
LazyLoadResult,
Expand Down Expand Up @@ -84,10 +84,6 @@ export function loadNgModule(
/**
* Returns the module factory that can be used to instantiate a module
*
* For strings this:
* - Finds the correct NgModuleFactoryLoader
* - Loads the new NgModuleFactory from the path string (async)
*
* For a Type<any> or Promise<Type<any>> this:
* - Compiles the component type (if not running with AOT)
* - Returns the NgModuleFactory resulting from compilation (or direct loading if using AOT) as a Promise
Expand All @@ -98,10 +94,6 @@ export function loadModuleFactory(
moduleToLoad: ModuleTypeCallback,
ng2Injector: Injector
): Promise<NgModuleFactory<any>> {
if (isString(moduleToLoad)) {
return ng2Injector.get(NgModuleFactoryLoader).load(moduleToLoad);
}

const compiler: Compiler = ng2Injector.get(Compiler);

const unwrapEsModuleDefault = (x) => (x && x.__esModule && x['default'] ? x['default'] : x);
Expand Down
3 changes: 1 addition & 2 deletions test-angular-versions/v10/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule, NgModuleFactoryLoader, SystemJsNgModuleLoader } from '@angular/core';
import { NgModule } from '@angular/core';
import { UIRouterModule } from '@uirouter/angular';
import { UIRouter } from '@uirouter/core';

Expand All @@ -19,7 +19,6 @@ export function config(router: UIRouter) {

@NgModule({
imports: [BrowserModule, UIRouterModule.forRoot({ states, config })],
providers: [{ provide: NgModuleFactoryLoader, useClass: SystemJsNgModuleLoader }],
declarations: [AppComponent, HomeComponent, AboutComponent],
bootstrap: [AppComponent],
})
Expand Down
3 changes: 1 addition & 2 deletions test-angular-versions/v11/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule, NgModuleFactoryLoader, SystemJsNgModuleLoader } from '@angular/core';
import { NgModule } from '@angular/core';
import { UIRouterModule } from '@uirouter/angular';
import { UIRouter } from '@uirouter/core';

Expand All @@ -19,7 +19,6 @@ export function config(router: UIRouter) {

@NgModule({
imports: [BrowserModule, UIRouterModule.forRoot({ states, config })],
providers: [{ provide: NgModuleFactoryLoader, useClass: SystemJsNgModuleLoader }],
declarations: [AppComponent, HomeComponent, AboutComponent],
bootstrap: [AppComponent],
})
Expand Down
3 changes: 0 additions & 3 deletions test/ngModule/deferInitialRender.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import {
APP_INITIALIZER,
ApplicationInitStatus,
Component,
NgModuleFactoryLoader,
SystemJsNgModuleLoader,
} from '@angular/core';
import { Ng2StateDeclaration } from '../../src/interface';

Expand Down Expand Up @@ -43,7 +41,6 @@ const setupTests = (deferInitialRender: boolean) => {
declarations: [HomeComponent, AppComponent],
imports: [routerModule],
providers: [
{ provide: NgModuleFactoryLoader, useClass: SystemJsNgModuleLoader },
{ provide: APP_INITIALIZER, useValue: () => appInitializer, multi: true },
],
});
Expand Down
2 changes: 0 additions & 2 deletions test/ngModule/lazyModule.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { async, inject, TestBed } from '@angular/core/testing';
import { UIRouterModule } from '../../src/uiRouterNgModule';
import { UIView } from '../../src/directives/uiView';
import { memoryLocationPlugin, UIRouter } from '@uirouter/core';
import { NgModuleFactoryLoader, SystemJsNgModuleLoader } from '@angular/core';

declare let System;

Expand Down Expand Up @@ -40,7 +39,6 @@ describe('lazy loading', () => {
TestBed.configureTestingModule({
declarations: [],
imports: [routerModule],
providers: [{ provide: NgModuleFactoryLoader, useClass: SystemJsNgModuleLoader }],
});
});

Expand Down