Skip to content

Commit e32d3fc

Browse files
committed
feat: updated angular sample to 19.1
1 parent dccddf6 commit e32d3fc

Some content is hidden

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

70 files changed

+3514
-3466
lines changed

examples/angular/package-lock.json

Lines changed: 3430 additions & 3344 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/angular/package.json

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,27 @@
44
"version": "1.0.0",
55
"private": true,
66
"dependencies": {
7-
"@angular/animations": "~18.1.0",
8-
"@angular/common": "~18.1.0",
9-
"@angular/compiler": "~18.1.0",
10-
"@angular/core": "~18.1.0",
11-
"@angular/forms": "~18.1.0",
12-
"@angular/platform-browser": "~18.1.0",
13-
"@angular/platform-browser-dynamic": "~18.1.0",
14-
"@angular/router": "~18.1.0",
15-
"@nativescript/angular": "^18.0.0",
7+
"@angular/animations": "~19.1.0",
8+
"@angular/common": "~19.1.0",
9+
"@angular/compiler": "~19.1.0",
10+
"@angular/core": "~19.1.0",
11+
"@angular/forms": "~19.1.0",
12+
"@angular/platform-browser": "~19.1.0",
13+
"@angular/platform-browser-dynamic": "~19.1.0",
14+
"@angular/router": "~19.1.0",
15+
"@nativescript/angular": "^19.0.0",
1616
"@nativescript/core": "~8.8.0",
1717
"rxjs": "~7.8.0",
18-
"zone.js": "~0.14.0"
18+
"zone.js": "~0.15.0"
1919
},
2020
"devDependencies": {
21-
"@angular-devkit/build-angular": "~18.1.0",
22-
"@angular/compiler-cli": "~18.1.0",
21+
"@angular-devkit/build-angular": "~19.1.0",
22+
"@angular/compiler-cli": "~19.1.0",
2323
"@nativescript/android": "8.8.2",
24+
"@nativescript/ios": "8.8.2",
2425
"@nativescript/types": "~8.8.0",
2526
"@nativescript/webpack": "~5.0.0",
26-
"@ngtools/webpack": "~18.1.0",
27-
"typescript": "~5.4.0"
27+
"@ngtools/webpack": "~19.1.0",
28+
"typescript": "~5.7.0"
2829
}
2930
}

examples/angular/src/app.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import { Component } from '@angular/core'
1+
import { Component, NO_ERRORS_SCHEMA } from '@angular/core'
2+
import { PageRouterOutlet } from '@nativescript/angular';
23

34
@Component({
45
selector: 'ns-app',
56
templateUrl: './app.component.html',
7+
imports: [PageRouterOutlet],
8+
schemas: [NO_ERRORS_SCHEMA],
69
})
710
export class AppComponent {}

examples/angular/src/app.module.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

examples/angular/src/app-routing.module.ts renamed to examples/angular/src/app.routes.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import { NgModule } from '@angular/core'
21
import { Routes } from '@angular/router'
3-
import { NativeScriptRouterModule } from '@nativescript/angular'
4-
52
import { HomeComponent } from './home.component'
63

74
import { ActionBarComponent } from './ui/ActionBar/component'
@@ -28,7 +25,7 @@ import { TimePickerComponent } from './ui/TimePicker/component'
2825
import { ViewOriginComponent } from './ui/ViewOrigin/component'
2926
import { WebViewComponent } from './ui/WebView/component'
3027

31-
const routes: Routes = [
28+
export const routes: Routes = [
3229
{ path: '', redirectTo: '/home', pathMatch: 'full' },
3330
{ path: 'home', component: HomeComponent },
3431
{ path: 'ui/ActionBar', component: ActionBarComponent },
@@ -54,10 +51,4 @@ const routes: Routes = [
5451
{ path: 'ui/TimePicker', component: TimePickerComponent },
5552
{ path: 'ui/ViewOrigin', component: ViewOriginComponent },
5653
{ path: 'ui/WebView', component: WebViewComponent },
57-
]
58-
59-
@NgModule({
60-
imports: [NativeScriptRouterModule.forRoot(routes)],
61-
exports: [NativeScriptRouterModule],
62-
})
63-
export class AppRoutingModule {}
54+
]

examples/angular/src/home.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
import { Component, inject } from '@angular/core'
2-
import { RouterExtensions } from '@nativescript/angular'
1+
import { Component, inject, NO_ERRORS_SCHEMA, signal } from '@angular/core'
2+
import { NativeScriptCommonModule, RouterExtensions } from '@nativescript/angular'
33
import { getComponentList } from '@example/utils';
44

55
@Component({
66
selector: 'ns-home',
77
templateUrl: './home.component.html',
8+
imports: [NativeScriptCommonModule],
9+
schemas: [NO_ERRORS_SCHEMA]
810
})
911
export class HomeComponent {
1012
router = inject(RouterExtensions)

examples/angular/src/main.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
1-
import { platformNativeScript, runNativeScriptAngularApp } from '@nativescript/angular';
1+
import {
2+
bootstrapApplication,
3+
provideNativeScriptHttpClient,
4+
provideNativeScriptRouter,
5+
runNativeScriptAngularApp,
6+
} from '@nativescript/angular';
7+
import { provideExperimentalZonelessChangeDetection } from '@angular/core';
8+
import { withInterceptorsFromDi } from '@angular/common/http';
9+
import { AppComponent } from './app.component';
10+
import { routes } from './app.routes';
211

3-
import { AppModule } from './app.module';
412

513
runNativeScriptAngularApp({
6-
appModuleBootstrap: () => platformNativeScript().bootstrapModule(AppModule),
14+
appModuleBootstrap: () => {
15+
return bootstrapApplication(AppComponent, {
16+
providers: [
17+
provideNativeScriptHttpClient(withInterceptorsFromDi()),
18+
provideNativeScriptRouter(routes),
19+
provideExperimentalZonelessChangeDetection()
20+
],
21+
});
22+
},
723
});
8-

examples/angular/src/polyfills.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,4 @@
55
// Install @nativescript/core polyfills (XHR, setTimeout, requestAnimationFrame)
66
import '@nativescript/core/globals';
77
// Install @nativescript/angular specific polyfills
8-
import '@nativescript/angular/polyfills';
9-
10-
/**
11-
* Zone.js and patches
12-
*/
13-
// Add pre-zone.js patches needed for the NativeScript platform
14-
import '@nativescript/zone-js/dist/pre-zone-polyfills';
15-
16-
// Zone JS is required by default for Angular itself
17-
import 'zone.js';
18-
19-
// Add NativeScript specific Zone JS patches
20-
import '@nativescript/zone-js';
8+
import '@nativescript/angular/polyfills';

examples/angular/src/ui/ActionBar/component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { NativeScriptCommonModule, RouterExtensions } from '@nativescript/angula
44
@Component({
55
selector: 'ns-action-bar',
66
templateUrl: './component.html',
7-
standalone: true,
87
imports: [NativeScriptCommonModule],
98
schemas: [NO_ERRORS_SCHEMA]
109
})

examples/angular/src/ui/ActivityIndicator/component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { NativeScriptCommonModule } from '@nativescript/angular';
44
@Component({
55
selector: 'ns-activity-indicator',
66
templateUrl: './component.html',
7-
standalone: true,
87
imports: [NativeScriptCommonModule],
98
schemas: [NO_ERRORS_SCHEMA]
109
})

0 commit comments

Comments
 (0)