piral-ng 1.9.2-beta.8358 → 1.9.2-beta.8388
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -3
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -390,6 +390,54 @@ export class SampleTileComponent {
|
|
|
390
390
|
}
|
|
391
391
|
```
|
|
392
392
|
|
|
393
|
+
## Setting Up Routing
|
|
394
|
+
|
|
395
|
+
You can use the Angular router for (sub)pages that you register in your pilet's root module. In general the idea is that your page that includes a `<router-outlet>` will be registered in the global routing, but with a wildcard indicating that requests to paths below the main route are also handled by this page:
|
|
396
|
+
|
|
397
|
+
```ts
|
|
398
|
+
export function setup(app: PiletApi) {
|
|
399
|
+
const fromNg = createConverter(() => import('./app/app.module.ts'));
|
|
400
|
+
|
|
401
|
+
app.registerPage(`/app/*`, fromNg('app-page'));
|
|
402
|
+
}
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
In your `app.module` include a routing module, e.g.:
|
|
406
|
+
|
|
407
|
+
```ts
|
|
408
|
+
import { NgModule } from "@angular/core";
|
|
409
|
+
import { RouterModule, Routes } from "@angular/router";
|
|
410
|
+
|
|
411
|
+
import { FirstPageComponent } from "./first.component";
|
|
412
|
+
import { SecondPageComponent } from "./second.component";
|
|
413
|
+
|
|
414
|
+
const routes: Routes = [
|
|
415
|
+
{ path: "", redirectTo: "one", pathMatch: "full" },
|
|
416
|
+
{ path: "one", component: FirstPageComponent },
|
|
417
|
+
{ path: "two", component: SecondPageComponent },
|
|
418
|
+
];
|
|
419
|
+
|
|
420
|
+
@NgModule({
|
|
421
|
+
imports: [RouterModule.forRoot(routes, { resolveNavigationPromiseOnError: true })],
|
|
422
|
+
exports: [RouterModule],
|
|
423
|
+
})
|
|
424
|
+
export class AppRoutingModule {}
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
The `resolveNavigationPromiseOnError` option makes sure to hide navigation errors that will occur when you navigate globally, e.g., from a route defined in one micro frontend to some route from another micro frontend.
|
|
428
|
+
|
|
429
|
+
As mentioned the linked `app-page` may be as simple as:
|
|
430
|
+
|
|
431
|
+
```ts
|
|
432
|
+
import { Component } from "@angular/core";
|
|
433
|
+
|
|
434
|
+
@Component({
|
|
435
|
+
selector: 'app-page',
|
|
436
|
+
template: '<router-outlet></router-outlet>',
|
|
437
|
+
})
|
|
438
|
+
export class AppComponent {}
|
|
439
|
+
```
|
|
440
|
+
|
|
393
441
|
## Converting an Angular Application to a Pilet
|
|
394
442
|
|
|
395
443
|
Depending on the kind of Angular application this may be rather straight forward or very difficult. Since we cannot discuss all possible edge cases we will assume the standard scenario. If you need more help then don't hesitate to contact us.
|
|
@@ -493,7 +541,7 @@ If you still need to use `templateUrl` (or `styleUrls`) then take a look below a
|
|
|
493
541
|
|
|
494
542
|
## Angular Versions
|
|
495
543
|
|
|
496
|
-
This plugin works with recent versions of Angular (right now
|
|
544
|
+
This plugin works with recent versions of Angular (right now 16 - 20) and (previously, i.e., not continuously tested) legacy versions starting with Angular 9. Support for Angular.js (also known as Angular 1) is given via `piral-ngjs`.
|
|
497
545
|
|
|
498
546
|
### Angular 9
|
|
499
547
|
|
|
@@ -740,7 +788,7 @@ The basic dependencies look as follows:
|
|
|
740
788
|
}
|
|
741
789
|
```
|
|
742
790
|
|
|
743
|
-
Besides the usual imports, the explicit import of the `@angular/compiler` package may be necessary. TypeScript has to be higher or equal to 5.
|
|
791
|
+
Besides the usual imports, the explicit import of the `@angular/compiler` package may be necessary. TypeScript has to be higher or equal to 5.5 (and less than 5.6).
|
|
744
792
|
|
|
745
793
|
So include in your app shell as preamble:
|
|
746
794
|
|
|
@@ -769,7 +817,36 @@ The basic dependencies look as follows:
|
|
|
769
817
|
}
|
|
770
818
|
```
|
|
771
819
|
|
|
772
|
-
Besides the usual imports, the explicit import of the `@angular/compiler` package may be necessary. TypeScript has to be higher or equal to 5.
|
|
820
|
+
Besides the usual imports, the explicit import of the `@angular/compiler` package may be necessary. TypeScript has to be higher or equal to 5.7 (and less than 5.9).
|
|
821
|
+
|
|
822
|
+
So include in your app shell as preamble:
|
|
823
|
+
|
|
824
|
+
```js
|
|
825
|
+
import 'core-js/proposals/reflect-metadata';
|
|
826
|
+
import '@angular/compiler';
|
|
827
|
+
```
|
|
828
|
+
|
|
829
|
+
### Angular 20
|
|
830
|
+
|
|
831
|
+
In general, Angular 20 seems to work and is **supported**.
|
|
832
|
+
|
|
833
|
+
The basic dependencies look as follows:
|
|
834
|
+
|
|
835
|
+
```json
|
|
836
|
+
{
|
|
837
|
+
"@angular/common": "^20",
|
|
838
|
+
"@angular/compiler": "^20",
|
|
839
|
+
"@angular/core": "^20",
|
|
840
|
+
"@angular/router": "^20",
|
|
841
|
+
"@angular/platform-browser": "^20",
|
|
842
|
+
"@angular/platform-browser-dynamic": "^20",
|
|
843
|
+
"core-js": "^3",
|
|
844
|
+
"rxjs": "^7.4",
|
|
845
|
+
"zone.js": "~0.15"
|
|
846
|
+
}
|
|
847
|
+
```
|
|
848
|
+
|
|
849
|
+
Besides the usual imports, the explicit import of the `@angular/compiler` package may be necessary. TypeScript has to be higher or equal to 5.8 (and less than 5.9).
|
|
773
850
|
|
|
774
851
|
So include in your app shell as preamble:
|
|
775
852
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-ng",
|
|
3
|
-
"version": "1.9.2-beta.
|
|
3
|
+
"version": "1.9.2-beta.8388",
|
|
4
4
|
"description": "Plugin for integrating Angular components in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"./extend-webpack": "./extend-webpack.js",
|
|
29
29
|
"./standalone": "./lib/standalone.js",
|
|
30
30
|
"./lib/*": {
|
|
31
|
-
"
|
|
32
|
-
"
|
|
31
|
+
"types": "./lib/*.d.ts",
|
|
32
|
+
"import": "./lib/*"
|
|
33
33
|
},
|
|
34
34
|
"./package.json": "./package.json"
|
|
35
35
|
},
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
"@angular/platform-browser": "^16.0.0",
|
|
72
72
|
"@angular/platform-browser-dynamic": "^16.0.0",
|
|
73
73
|
"@angular/router": "^16.0.0",
|
|
74
|
-
"piral-core": "1.9.2-beta.
|
|
74
|
+
"piral-core": "1.9.2-beta.8388",
|
|
75
75
|
"piral-ng-common": "^16.0.0",
|
|
76
76
|
"rxjs": "^7.3.0"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "25023f913ae9423c9cecd23e44d70e959ff58c8a"
|
|
79
79
|
}
|