feat: add router input binding by edusperoni · Pull Request #165 · NativeScript/angular · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions apps/nativescript-demo-ng/src/app/app.routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Component, input, NO_ERRORS_SCHEMA } from '@angular/core';
import { NativeScriptCommonModule } from '@nativescript/angular';

@Component({
selector: 'ns-input-binding-demo',
template: `
<ActionBar title="Input Binding Demo" class="action-bar"></ActionBar>
<StackLayout class="p-4">
<Label text="Route Input Binding Demo" class="text-2xl font-bold text-center"></Label>

<Label class="mt-4 text-lg font-bold" text="Route Param:"></Label>
<Label class="text-base" [text]="'name = ' + name()"></Label>

<Label class="mt-4 text-lg font-bold" text="Query Param:"></Label>
<Label class="text-base" [text]="'language = ' + language()"></Label>

<Label class="mt-4 text-lg font-bold" text="Resolver Data:"></Label>
<Label class="text-base" [text]="'timestamp = ' + timestamp()"></Label>

<Label class="mt-4 text-lg font-bold" text="Static Route Data:"></Label>
<Label class="text-base" [text]="'title = ' + title()"></Label>
</StackLayout>
`,
imports: [NativeScriptCommonModule],
schemas: [NO_ERRORS_SCHEMA],
})
export class InputBindingDemoComponent {
name = input<string>();
language = input<string>();
timestamp = input<string>();
title = input<string>();
}
10 changes: 10 additions & 0 deletions apps/nativescript-demo-ng/src/app/item3/items.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@
backgroundColor="#00d2ff"
class="text-white mt-2 w-full font-bold h-[50]"
></Button>
<Button
[nsRouterLink]="['/input-binding-demo', 'Angular']"
[queryParams]="{ language: 'en' }"
text="Input Binding Demo"
[borderRadius]="borderRadius"
[fontSize]="fontSize"
padding="0"
backgroundColor="#4CAF50"
class="text-white mt-2 w-full font-bold h-[50]"
></Button>
</StackLayout>
<ListView row="1" [items]="items" backgroundColor="#efefef">
<ng-template let-item="item">
Expand Down
2 changes: 2 additions & 0 deletions apps/nativescript-demo-ng/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
provideNativeScriptNgZone,
provideNativeScriptRouter,
runNativeScriptAngularApp,
provideComponentInputBinding,
} from '@nativescript/angular';
import { Trace, Utils, SplitView } from '@nativescript/core';

Expand Down Expand Up @@ -38,6 +39,7 @@ runNativeScriptAngularApp({
providers: [
provideNativeScriptHttpClient(withInterceptorsFromDi()),
provideNativeScriptRouter(routes),
provideComponentInputBinding(),
// provideNativeScriptRouter(SPLIT_VIEW_ROUTES),
ZONELESS ? provideZonelessChangeDetection() : provideNativeScriptNgZone(),
],
Expand Down
Loading