-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(angular): use standalone components with routing (#25589)
Resolves #25404
- Loading branch information
1 parent
8a1b3c5
commit 3c84d48
Showing
14 changed files
with
161 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
describe('Routing with Standalone Components', () => { | ||
beforeEach(() => { | ||
cy.visit('/version-test/standalone'); | ||
}); | ||
|
||
it('should render the component', () => { | ||
cy.get('ion-content').contains('This is a standalone component rendered from a route.'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<ion-app> | ||
<ion-router-outlet [environmentInjector]="environmentInjector"></ion-router-outlet> | ||
</ion-app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Component, EnvironmentInjector } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './app.component.html', | ||
styleUrls: ['./app.component.css'] | ||
}) | ||
export class AppComponent { | ||
|
||
constructor(public environmentInjector: EnvironmentInjector) { } | ||
} |
4 changes: 4 additions & 0 deletions
4
angular/test/apps/ng14/src/app/version-test/standalone/standalone.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<ion-content> | ||
<p>This is a standalone component rendered from a route.</p> | ||
<ion-button routerLink="/">Return home</ion-button> | ||
</ion-content> |
12 changes: 12 additions & 0 deletions
12
angular/test/apps/ng14/src/app/version-test/standalone/standalone.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Component } from "@angular/core"; | ||
import { RouterModule } from "@angular/router"; | ||
|
||
import { IonicModule } from '@ionic/angular'; | ||
|
||
@Component({ | ||
selector: 'app-standalone', | ||
templateUrl: './standalone.component.html', | ||
standalone: true, | ||
imports: [IonicModule, RouterModule] | ||
}) | ||
export class StandaloneComponent { } |
15 changes: 15 additions & 0 deletions
15
angular/test/apps/ng14/src/app/version-test/version-test-routing.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { NgModule } from "@angular/core"; | ||
import { RouterModule } from "@angular/router"; | ||
|
||
@NgModule({ | ||
imports: [ | ||
RouterModule.forChild([ | ||
{ | ||
path: 'standalone', | ||
loadComponent: () => import('./standalone/standalone.component').then(m => m.StandaloneComponent) | ||
} | ||
]) | ||
], | ||
exports: [RouterModule] | ||
}) | ||
export class VersionTestRoutingModule { } |
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
angular/test/base/src/app/version-test/version-test-routing.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"compileOnSave": false, | ||
"compilerOptions": { | ||
"importHelpers": true, | ||
"outDir": "./dist/out-tsc", | ||
"sourceMap": true, | ||
"declaration": false, | ||
"moduleResolution": "node", | ||
"module": "es2020", | ||
"target": "es2020", | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true, | ||
"typeRoots": ["node_modules/@types"], | ||
"lib": ["es2018", "dom"], | ||
"plugins": [ | ||
{ | ||
"name": "typescript-eslint-language-service" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
# The directory where the source | ||
# for each specific application is. | ||
APPS_DIR="apps" | ||
|
||
# The directory where the | ||
# base application logic is | ||
BASE_DIR="base" | ||
BUILD_DIR="build" | ||
|
||
# The specific application | ||
# we are building | ||
APP_DIR="${1}" | ||
|
||
# The full path to the specific application. | ||
FULL_APP_DIR="${APPS_DIR}/${APP_DIR}/e2e" | ||
|
||
# The full path to the base application. | ||
FULL_BASE_DIR="${BASE_DIR}/e2e" | ||
|
||
# The full path to the built application. | ||
BUILD_APP_DIR="${BUILD_DIR}/${APP_DIR}/" | ||
|
||
# Make the build directory if it does not already exist. | ||
mkdir -p $BUILD_DIR | ||
|
||
# First we need to copy the base application | ||
cp -R $FULL_BASE_DIR $BUILD_APP_DIR | ||
|
||
# Then we can copy the specific app which | ||
# will override any files in the base application. | ||
cp -R $FULL_APP_DIR $BUILD_APP_DIR | ||
|
||
echo "Synced e2e tests for ${APP_DIR}" |