Skip to content

Commit b765e02

Browse files
authored
chore: angular 9 cleanup (#2188)
1 parent 4ae759b commit b765e02

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+249
-201
lines changed

e2e/animation-examples/app/app.module.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import {
55
APP_INITIALIZER
66
} from "@angular/core";
77

8-
import { NativeScriptModule } from "@nativescript/angular";
9-
import { NativeScriptAnimationsModule } from "@nativescript/angular/animations";
10-
import { NSModuleFactoryLoader } from "@nativescript/angular/router";
8+
import { NativeScriptModule, NativeScriptAnimationsModule } from "@nativescript/angular";
119

1210
import { AppRoutingModule } from "./app.routing";
1311
import { AnimationsListComponent } from "./animations-list.component";

e2e/animation-examples/app/selector-all.component.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
transition,
66
trigger,
77
} from "@angular/animations";
8-
import { Component } from "@angular/core";
8+
import { Component, NgZone } from "@angular/core";
99

1010
@Component({
1111
moduleId: module.id,
@@ -31,7 +31,7 @@ import { Component } from "@angular/core";
3131
template: `
3232
<FlexboxLayout flexDirection="column"
3333
automationText="itemsContainer">
34-
<Button text="add" automationText="add" (tap)="items.push('random')"></Button>
34+
<Button text="add" automationText="add" (tap)="addRandom()"></Button>
3535
3636
<FlexboxLayout
3737
flexDirection="column"
@@ -54,11 +54,19 @@ export class SelectorAllComponent {
5454
"second",
5555
];
5656

57+
constructor(private zone: NgZone) {}
58+
5759
add() {
5860
const newItem = `Item ${this.items.length}`;
5961
this.items.push(newItem);
6062
}
6163

64+
addRandom() {
65+
// this.zone.run(() => {
66+
this.items.push('random');
67+
// });
68+
}
69+
6270
remove(item) {
6371
const index = this.items.indexOf(item);
6472
this.items.splice(index, 1)

e2e/animation-examples/package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"typescript": "~3.8.3"
4848
},
4949
"scripts": {
50-
"clean": "npx rimraf hooks node_modules package-lock.json",
50+
"clean": "npx rimraf hooks node_modules platforms package-lock.json",
5151
"setup": "cd ../../nativescript-angular && npm run pack && cd ../e2e/animation-examples && npm run clean",
5252
"u": "update-ns-webpack",
5353
"e2e": "tsc -p e2e && mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json",
@@ -56,6 +56,8 @@
5656
"ns-verify-bundle": "ns-verify-bundle",
5757
"update-ns-webpack": "update-ns-webpack",
5858
"ngcc": "ngcc --properties es2015 module main --first-only",
59-
"postinstall": "npm run ngcc"
59+
"postinstall": "npm run ngcc",
60+
"ios": "tns debug ios --env.aot --emulator --no-hmr",
61+
"android": "tns debug android --env.aot --emulator --no-hmr"
6062
}
6163
}

e2e/modal-navigation-ng/app/app.routing.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { NgModule } from "@angular/core";
2-
import { NativeScriptRouterModule } from "@nativescript/angular/router";
2+
import { NativeScriptRouterModule } from "@nativescript/angular";
33
import { Routes, Router } from "@angular/router";
44

55
import { HomeComponent } from "./home/home.component";

e2e/modal-navigation-ng/app/home/home.component.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Component, ViewContainerRef } from "@angular/core";
2-
import { ModalDialogService, ModalDialogOptions } from "@nativescript/angular/directives/dialogs";
3-
import { RouterExtensions } from "@nativescript/angular/router";
4-
import { EventData } from "@nativescript/core/data/observable";
2+
import { ModalDialogService, ModalDialogOptions, RouterExtensions } from "@nativescript/angular";
3+
import { EventData } from "@nativescript/core";
54

65
import { ViewContainerRefService } from "../shared/ViewContainerRefService";
76
import { ModalRouterComponent } from "../modal/modal-router/modal-router.component";

e2e/modal-navigation-ng/app/layout.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, ViewContainerRef } from "@angular/core";
22
import { Router, NavigationEnd } from "@angular/router";
33
import { NSLocationStrategy } from "@nativescript/angular";
4-
import { ModalDialogService, ModalDialogOptions } from "@nativescript/angular/directives/dialogs";
4+
import { ModalDialogService, ModalDialogOptions } from "@nativescript/angular";
55
import { ModalViewComponent } from "./modal-shared/modal-view.component";
66
import { ViewContainerRefService } from "./shared/ViewContainerRefService";
77
import { AppModule } from "./app.module";

e2e/modal-navigation-ng/app/modal-nested/modal-nested.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component } from "@angular/core";
22
import { View, ShownModallyData } from "@nativescript/core/ui/core/view"
3-
import { ModalDialogParams } from "@nativescript/angular/directives/dialogs";
3+
import { ModalDialogParams } from "@nativescript/angular";
44

55
@Component({
66
moduleId: module.id,

e2e/modal-navigation-ng/app/modal-second/modal-second.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component } from "@angular/core";
22
import { View } from "@nativescript/core/ui/core/view"
33
import { ActivatedRoute } from "@angular/router";
4-
import { RouterExtensions } from "@nativescript/angular/router";
4+
import { RouterExtensions } from "@nativescript/angular";
55

66
@Component({
77
moduleId: module.id,

e2e/modal-navigation-ng/app/modal-shared/modal-shared-second.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Component } from "@angular/core";
2-
import { ModalDialogOptions, ModalDialogService } from "@nativescript/angular/modal-dialog";
2+
import { ModalDialogOptions, ModalDialogService } from "@nativescript/angular";
33

44
import { ViewContainerRefService } from "../shared/ViewContainerRefService";
55
import { ModalViewComponent } from "../modal-shared/modal-view.component";
6-
import { RouterExtensions } from "@nativescript/angular/router";
6+
import { RouterExtensions } from "@nativescript/angular";
77

88
@Component({
99
selector: "ns-second",

e2e/modal-navigation-ng/app/modal-shared/modal-view-content.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component } from "@angular/core";
2-
import { ModalDialogParams } from "@nativescript/angular/modal-dialog";
2+
import { ModalDialogParams } from "@nativescript/angular";
33

44
@Component({
55
selector: "ModalViewContent",

e2e/modal-navigation-ng/app/modal-shared/modal-view.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, OnInit } from "@angular/core";
2-
import { RouterExtensions } from "@nativescript/angular/router";
2+
import { RouterExtensions } from "@nativescript/angular";
33

44
@Component({
55
selector: "ModalView",

e2e/modal-navigation-ng/app/modal/modal-router/modal-router.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, OnInit } from "@angular/core";
22
import { ActivatedRoute } from "@angular/router";
3-
import { RouterExtensions } from "@nativescript/angular/router";
4-
import { ModalDialogParams } from "@nativescript/angular/directives/dialogs";
3+
import { RouterExtensions } from "@nativescript/angular";
4+
import { ModalDialogParams } from "@nativescript/angular";
55

66
@Component({
77
moduleId: module.id,

e2e/modal-navigation-ng/app/modal/modal.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component, ViewContainerRef } from "@angular/core";
2-
import { ModalDialogParams, ModalDialogOptions, ModalDialogService } from "@nativescript/angular/directives/dialogs";
3-
import { RouterExtensions, PageRoute } from "@nativescript/angular/router";
2+
import { ModalDialogParams, ModalDialogOptions, ModalDialogService } from "@nativescript/angular";
3+
import { RouterExtensions, PageRoute } from "@nativescript/angular";
44
import { ActivatedRoute } from "@angular/router";
55
import { View, ShownModallyData, EventData } from "@nativescript/core/ui/core/view"
66
import { confirm } from "@nativescript/core/ui/dialogs";

e2e/modal-navigation-ng/app/navigation/basic.navigation.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component, ViewContainerRef, Input, ViewChild, ElementRef } from "@angular/core";
22
import { Router, NavigationEnd } from "@angular/router";
3-
import { ModalDialogService, ModalDialogOptions } from "@nativescript/angular/directives/dialogs";
3+
import { ModalDialogService, ModalDialogOptions } from "@nativescript/angular";
44
import { ModalComponent } from "../modal/modal.component";
55
import { ModalRouterComponent } from "../modal/modal-router/modal-router.component";
66
import { confirm } from "@nativescript/core/ui/dialogs";

e2e/modal-navigation-ng/app/second/second.component.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { Component, ViewContainerRef } from "@angular/core";
2-
import { ModalDialogService, ModalDialogOptions } from "@nativescript/angular/directives/dialogs";
3-
import { EventData } from "@nativescript/core/data/observable";
4-
import { Frame } from "@nativescript/core/ui/frame";
5-
import { View } from "@nativescript/core/ui/core/view";
2+
import { ModalDialogService, ModalDialogOptions } from "@nativescript/angular";
3+
import { EventData } from "@nativescript/core";
4+
import { Frame } from "@nativescript/core";
5+
import { View } from "@nativescript/core";
66
import { ModalRouterComponent } from "../modal/modal-router/modal-router.component";
7-
import { PageRouterOutlet } from "@nativescript/angular/router/page-router-outlet";
8-
import { RouterExtensions } from "@nativescript/angular/router";
7+
import { RouterExtensions } from "@nativescript/angular";
98
import { ModalComponent } from "../modal/modal.component";
109
import { AppModule } from "../app.module";
1110
@Component({

e2e/modal-navigation-ng/package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@
4949
"scripts": {
5050
"e2e": "tsc -p e2e && mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json",
5151
"e2e-watch": "tsc -p e2e --watch",
52-
"clean": "npx rimraf hooks node_modules package-lock.json",
53-
"setup": "cd ../../nativescript-angular && npm run pack && cd ../e2e/animation-examples && npm run clean",
52+
"clean": "npx rimraf hooks node_modules platforms package-lock.json",
53+
"setup": "cd ../../nativescript-angular && npm run pack && cd ../e2e/modal-navigation-ng && npm run clean",
5454
"ngcc": "ngcc --properties es2015 module main --first-only",
55-
"postinstall": "npm run ngcc"
55+
"postinstall": "npm run ngcc",
56+
"ios": "tns debug ios --env.aot --emulator --no-hmr",
57+
"android": "tns debug android --env.aot --emulator --no-hmr"
5658
}
5759
}

e2e/nested-router-tab-view/app/modal/modal.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export class ModalComponent {
2626
}
2727

2828
close(layoutRoot: View) {
29-
layoutRoot.closeModal();
29+
this.modal.closeModal();
30+
// layoutRoot.closeModal();
3031
}
3132

3233
ngOnInit() {

e2e/nested-router-tab-view/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
"compile-tests": "tsc -p e2e --watch",
4747
"e2e": "tsc -p e2e && mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json",
4848
"e2e-watch": "tsc -p e2e --watch",
49-
"clean": "npx rimraf hooks node_modules package-lock.json",
50-
"setup": "cd ../../nativescript-angular && npm run pack && cd ../e2e/animation-examples && npm run clean",
49+
"clean": "npx rimraf hooks node_modules platforms package-lock.json",
50+
"setup": "cd ../../nativescript-angular && npm run pack && cd ../e2e/nested-router-tab-view && npm run clean",
5151
"ngcc": "ngcc --properties es2015 module main --first-only",
5252
"postinstall": "npm run ngcc"
5353
}

e2e/router/app/app-routing.module.ts

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
2-
import { NativeScriptRouterModule, NSEmptyOutletComponent } from "@nativescript/angular/router";
2+
import { NativeScriptRouterModule, NSEmptyOutletComponent } from "@nativescript/angular";
33

44
import { FirstComponent } from "./first/first.component"
55
import { SecondComponent } from "./second/second.component"
@@ -26,7 +26,7 @@ export const routes = [
2626
path: "lazy-named",
2727
outlet: "lazyNameOutlet",
2828
component: NSEmptyOutletComponent,
29-
loadChildren: "./lazy-named/lazy-named.module#LazyNamedModule",
29+
loadChildren: () => import('./lazy-named/lazy-named.module').then(m => m.LazyNamedModule),
3030
}
3131
]
3232
},
@@ -45,17 +45,11 @@ export const routes = [
4545
},
4646
{
4747
path: "lazy",
48-
loadChildren: "./lazy/lazy.module#LazyModule",
48+
component: NSEmptyOutletComponent,
49+
loadChildren: () => import('./lazy/lazy.module').then(m => m.LazyModule),
4950
}
5051
];
5152

52-
export const navigatableComponents = [
53-
FirstComponent,
54-
SecondComponent,
55-
MasterComponent,
56-
DetailComponent
57-
];
58-
5953
@NgModule({
6054
imports: [NativeScriptRouterModule, NativeScriptRouterModule.forRoot(routes)],
6155
exports: [NativeScriptRouterModule],

e2e/router/app/app.module.ngfactory.d.ts

-4
This file was deleted.

e2e/router/app/app.module.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import { NgModule, NgModuleFactoryLoader, NO_ERRORS_SCHEMA } from "@angular/core";
2-
import { NativeScriptModule } from "@nativescript/angular";
3-
import { NSModuleFactoryLoader } from "@nativescript/angular/router";
1+
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
2+
import { NativeScriptModule, NativeScriptAnimationsModule } from "@nativescript/angular";
43

54
import {
65
AppRoutingModule,
7-
navigatableComponents,
86
} from "./app-routing.module";
7+
import { FirstComponent } from "./first/first.component"
8+
import { SecondComponent } from "./second/second.component"
9+
import { MasterComponent } from "./second/master.component"
10+
import { DetailComponent } from "./second/detail.component"
911

1012
import { AppComponent } from "./app.component";
1113

@@ -17,14 +19,15 @@ enable();
1719
@NgModule({
1820
declarations: [
1921
AppComponent,
20-
...navigatableComponents,
22+
FirstComponent,
23+
SecondComponent,
24+
MasterComponent,
25+
DetailComponent,
2126
],
2227
bootstrap: [AppComponent],
23-
providers: [
24-
{ provide: NgModuleFactoryLoader, useClass: NSModuleFactoryLoader }
25-
],
2628
imports: [
2729
NativeScriptModule,
30+
// NativeScriptAnimationsModule,
2831
AppRoutingModule,
2932
],
3033
schemas: [NO_ERRORS_SCHEMA],

e2e/router/app/first/first.component.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component, OnInit, OnDestroy, OnChanges, DoCheck } from "@angular/core";
2-
import { RouterExtensions } from "@nativescript/angular/router";
3-
import { Page } from "@nativescript/core/ui/page";
2+
import { RouterExtensions } from "@nativescript/angular";
3+
import { Page } from "@nativescript/core";
44

55
import { CounterService } from "../counter.service";
66
import { ActivatedRoute } from "@angular/router";
@@ -39,6 +39,10 @@ export class FirstComponent implements OnInit, OnDestroy, DoCheck {
3939
console.log("FirstComponent - constructor() page: " + page);
4040
}
4141

42+
tapMe() {
43+
console.log('here!!!')
44+
}
45+
4246
ngOnInit() {
4347
console.log("FirstComponent - ngOnInit()");
4448
this.sub = this.route.queryParams.subscribe((params) =>{

e2e/router/app/lazy-named/lazy-named.module.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
22
import { Route } from "@angular/router";
33

4-
import { NativeScriptCommonModule } from "@nativescript/angular/common";
5-
import { NativeScriptRouterModule } from "@nativescript/angular/router";
4+
import { NativeScriptCommonModule, NativeScriptRouterModule } from "@nativescript/angular";
65

76
import { NestedMasterComponent } from "./nested-master.component"
87
import { NestedDetailComponent } from "./nested-detail.component"
@@ -24,6 +23,7 @@ const routes: Route[] = [
2423
NestedDetailComponent
2524
],
2625
exports:[
26+
NativeScriptRouterModule,
2727
NestedMasterComponent,
2828
NestedDetailComponent
2929
]

e2e/router/app/lazy-named/nested-detail.component.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { ActivatedRoute, Router, Route } from "@angular/router";
33
import { Location } from "@angular/common";
44
import { Observable } from "rxjs";
55
import { map } from "rxjs/operators";
6-
import { Page } from "@nativescript/core/ui/page";
7-
import { RouterExtensions } from "@nativescript/angular/router";
6+
import { Page } from "@nativescript/core";
7+
import { RouterExtensions } from "@nativescript/angular";
88

99
@Component({
10-
selector: "detail",
10+
selector: "nested-detail",
1111
template: `
1212
<GridLayout rows="auto, auto">
1313
<Label [text]="'nested-named-param: ' + (id$ | async)"></Label>

e2e/router/app/lazy-named/nested-master.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, OnInit, OnDestroy } from "@angular/core";
2-
import { Page } from "@nativescript/core/ui/page";
2+
import { Page } from "@nativescript/core";
33
@Component({
4-
selector: "master",
4+
selector: "nested-master",
55
template: `
66
<GridLayout rows="auto">
77
<StackLayout row="1" orientation="horizontal">

e2e/router/app/lazy/lazy-componentless-route.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { Component, OnInit, OnDestroy, OnChanges } from "@angular/core";
22
import { ActivatedRoute, Router, Route } from "@angular/router";
33
import { Location } from "@angular/common";
4-
import { RouterExtensions } from "@nativescript/angular/router";
4+
import { RouterExtensions } from "@nativescript/angular";
55

66
import { Page } from "@nativescript/core/ui/page";
77

88
@Component({
9-
selector: "lazy",
9+
selector: "lazy-cmp-less-route",
1010
template: `
1111
<StackLayout>
1212
<Label text="Lazy Componentless Route" class="header"></Label>

e2e/router/app/lazy/lazy.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Component, OnInit, OnDestroy, OnChanges } from "@angular/core";
22
import { ActivatedRoute, Router, Route } from "@angular/router";
33
import { Location } from "@angular/common";
4-
import { RouterExtensions } from "@nativescript/angular/router";
4+
import { RouterExtensions } from "@nativescript/angular";
55

6-
import { Page } from "@nativescript/core/ui/page";
6+
import { Page } from "@nativescript/core";
77

88
@Component({
99
selector: "lazy",

0 commit comments

Comments
 (0)