Skip to content

Commit

Permalink
chore(): revert angular standalone usage (#1772)
Browse files Browse the repository at this point in the history
  • Loading branch information
liamdebeasi committed Apr 21, 2023
1 parent 22482a8 commit bea44d9
Show file tree
Hide file tree
Showing 66 changed files with 603 additions and 288 deletions.
22 changes: 8 additions & 14 deletions angular/base/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@
"projects": {
"app": {
"projectType": "application",
"schematics": {
"@ionic/angular-toolkit:page": {
"styleext": "scss",
"standalone": true
}
},
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
Expand Down Expand Up @@ -129,27 +124,26 @@
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html"]
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
}
}
}
},
"cli": {
"schematicCollections": ["@ionic/angular-toolkit"]
"schematicCollections": [
"@ionic/angular-toolkit"
]
},
"schematics": {
"@ionic/angular-toolkit:component": {
"styleext": "scss"
},
"@ionic/angular-toolkit:page": {
"styleext": "scss"
},
"@angular-eslint/schematics:application": {
"setParserOptionsProject": true
},
"@angular-eslint/schematics:library": {
"setParserOptionsProject": true
}
}
}
9 changes: 6 additions & 3 deletions angular/base/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { TestBed } from '@angular/core/testing';
import { provideRouter } from '@angular/router';

import { AppComponent } from './app.component';

describe('AppComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AppComponent],
providers: [provideRouter([])],
declarations: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
}).compileComponents();
});

Expand All @@ -15,4 +17,5 @@ describe('AppComponent', () => {
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});

});
3 changes: 0 additions & 3 deletions angular/base/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { Component } from '@angular/core';
import { IonicModule } from '@ionic/angular';

@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['app.component.scss'],
standalone: true,
imports: [IonicModule],
})
export class AppComponent {
constructor() {}
Expand Down
15 changes: 15 additions & 0 deletions angular/base/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';

import { IonicModule, IonicRouteStrategy } from '@ionic/angular';

import { AppComponent } from './app.component';

@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, IonicModule.forRoot()],
providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }],
bootstrap: [AppComponent],
})
export class AppModule {}
18 changes: 5 additions & 13 deletions angular/base/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
import { enableProdMode, importProvidersFrom } from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
import { RouteReuseStrategy, provideRouter } from '@angular/router';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { routes } from './app/app.routes';
import { AppComponent } from './app/app.component';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

if (environment.production) {
enableProdMode();
}

bootstrapApplication(AppComponent, {
providers: [
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
importProvidersFrom(IonicModule.forRoot({})),
provideRouter(routes),
],
});
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.log(err));
2 changes: 1 addition & 1 deletion angular/base/src/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* (window as any).__Zone_enable_cross_context_check = true;
*
*/

import './zone-flags';

/***************************************************************************************************
Expand Down
5 changes: 4 additions & 1 deletion angular/base/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
"importHelpers": true,
"target": "es2022",
"module": "es2020",
"lib": ["es2018", "dom"],
"lib": [
"es2018",
"dom"
],
"useDefineForClassFields": false
},
"angularCompilerOptions": {
Expand Down
22 changes: 22 additions & 0 deletions angular/official/blank/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';

const routes: Routes = [
{
path: 'home',
loadChildren: () => import('./home/home.module').then( m => m.HomePageModule)
},
{
path: '',
redirectTo: 'home',
pathMatch: 'full'
},
];

@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule { }
16 changes: 16 additions & 0 deletions angular/official/blank/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';

import { IonicModule, IonicRouteStrategy } from '@ionic/angular';

import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';

@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule],
providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }],
bootstrap: [AppComponent],
})
export class AppModule {}
13 changes: 0 additions & 13 deletions angular/official/blank/src/app/app.routes.ts

This file was deleted.

16 changes: 16 additions & 0 deletions angular/official/blank/src/app/home/home-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HomePage } from './home.page';

const routes: Routes = [
{
path: '',
component: HomePage,
}
];

@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class HomePageRoutingModule {}
19 changes: 19 additions & 0 deletions angular/official/blank/src/app/home/home.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { IonicModule } from '@ionic/angular';
import { FormsModule } from '@angular/forms';
import { HomePage } from './home.page';

import { HomePageRoutingModule } from './home-routing.module';


@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
HomePageRoutingModule
],
declarations: [HomePage]
})
export class HomePageModule {}
6 changes: 6 additions & 0 deletions angular/official/blank/src/app/home/home.page.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';

import { HomePage } from './home.page';

Expand All @@ -7,6 +8,11 @@ describe('HomePage', () => {
let fixture: ComponentFixture<HomePage>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [HomePage],
imports: [IonicModule.forRoot()]
}).compileComponents();

fixture = TestBed.createComponent(HomePage);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
5 changes: 2 additions & 3 deletions angular/official/blank/src/app/home/home.page.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { Component } from '@angular/core';
import { IonicModule } from '@ionic/angular';

@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
standalone: true,
imports: [IonicModule],
})
export class HomePage {

constructor() {}

}
26 changes: 26 additions & 0 deletions angular/official/list/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';

const routes: Routes = [
{
path: 'home',
loadChildren: () => import('./home/home.module').then( m => m.HomePageModule)
},
{
path: 'message/:id',
loadChildren: () => import('./view-message/view-message.module').then( m => m.ViewMessagePageModule)
},
{
path: '',
redirectTo: 'home',
pathMatch: 'full'
},
];

@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule { }
22 changes: 0 additions & 22 deletions angular/official/list/src/app/app.component.spec.ts

This file was deleted.

16 changes: 16 additions & 0 deletions angular/official/list/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';

import { IonicModule, IonicRouteStrategy } from '@ionic/angular';

import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';

@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule],
providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }],
bootstrap: [AppComponent],
})
export class AppModule {}
19 changes: 0 additions & 19 deletions angular/official/list/src/app/app.routes.ts

This file was deleted.

17 changes: 17 additions & 0 deletions angular/official/list/src/app/home/home-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { HomePage } from './home.page';

const routes: Routes = [
{
path: '',
component: HomePage
}
];

@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class HomePageRoutingModule {}
20 changes: 20 additions & 0 deletions angular/official/list/src/app/home/home.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { IonicModule } from '@ionic/angular';
import { FormsModule } from '@angular/forms';

import { HomePage } from './home.page';
import { HomePageRoutingModule } from './home-routing.module';
import { MessageComponentModule } from '../message/message.module';

@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
MessageComponentModule,
HomePageRoutingModule
],
declarations: [HomePage]
})
export class HomePageModule {}
Loading

0 comments on commit bea44d9

Please sign in to comment.