Skip to content

Commit ed46d65

Browse files
committed
Update ng-sample with a RendererTest NgModule
1 parent b1d427f commit ed46d65

File tree

4 files changed

+36
-26
lines changed

4 files changed

+36
-26
lines changed

ng-sample/app/app.ts

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
//profiling.start('application-start');
77

88
// "nativescript-angular/application" import should be first in order to load some required settings (like globals and reflect-metadata)
9-
import { nativeScriptBootstrap, onAfterLivesync, onBeforeLivesync } from "nativescript-angular/application";
9+
//import { nativeScriptBootstrap, onAfterLivesync, onBeforeLivesync} from "nativescript-angular/application";
10+
import { NativeScriptModule, platformNativeScriptDynamic } from "nativescript-angular/platform";
11+
import { NgModule } from "@angular/core";
1012
import { Router } from "@angular/router";
11-
import { NS_ROUTER_PROVIDERS as NS_ROUTER_PROVIDERS_DEPRECATED } from "nativescript-angular/router-deprecated";
1213
import { NS_ROUTER_PROVIDERS } from "nativescript-angular/router";
1314
import { HTTP_PROVIDERS } from "@angular/http";
1415
import { rendererTraceCategory, routerTraceCategory, listViewTraceCategory } from "nativescript-angular/trace";
@@ -31,10 +32,6 @@ import {ModalTest} from "./examples/modal/modal-test";
3132
import {PlatfromDirectivesTest} from "./examples/platform-directives/platform-directives-test";
3233
import {LivesyncApp, LivesyncTestRouterProviders} from "./examples/livesync-test/livesync-test-app";
3334

34-
// router-deprecated
35-
import {NavigationTest} from "./examples/router-deprecated/navigation-test";
36-
import {RouterOutletTest} from "./examples/router-deprecated/router-outlet-test";
37-
import {LoginTest} from "./examples/router-deprecated/login-test";
3835

3936
// new router
4037
import { RouterOutletAppComponent, RouterOutletRouterProviders} from "./examples/router/router-outlet-test";
@@ -65,13 +62,24 @@ import { AnimationStatesTest } from "./examples/animation/animation-states-test"
6562
// nativeScriptBootstrap(RouterOutletAppComponent, [RouterOutletRouterProviders]);
6663
// nativeScriptBootstrap(PageRouterOutletAppComponent, [PageRouterOutletRouterProviders]);
6764
// nativeScriptBootstrap(PageRouterOutletNestedAppComponent, [PageRouterOutletNestedRouterProviders]);
68-
nativeScriptBootstrap(ClearHistoryAppComponent, [ClearHistoryRouterProviders]);
65+
// nativeScriptBootstrap(ClearHistoryAppComponent, [ClearHistoryRouterProviders]);
6966
// nativeScriptBootstrap(LoginAppComponent, [LoginExampleProviders]);
7067

71-
// router-deprecated
72-
// nativeScriptBootstrap(NavigationTest, [NS_ROUTER_PROVIDERS_DEPRECATED]);
73-
// nativeScriptBootstrap(RouterOutletTest, [NS_ROUTER_PROVIDERS_DEPRECATED]);
74-
// nativeScriptBootstrap(LoginTest, [NS_ROUTER_PROVIDERS_DEPRECATED]);
68+
@NgModule({
69+
bootstrap: [
70+
RendererTest
71+
],
72+
declarations: [
73+
RendererTest
74+
],
75+
imports: [
76+
NativeScriptModule,
77+
],
78+
providers: []
79+
})
80+
class RendererTestModule {}
81+
82+
platformNativeScriptDynamic().bootstrapModule(RendererTestModule);
7583

7684
// Livesync test
7785
// var cahcedUrl: string;

ng-sample/app/examples/action-bar/action-bar-test.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import {Component} from '@angular/core';
2-
import {RouteConfig} from '@angular/router-deprecated';
2+
//TODO: port to latest router
3+
//import {RouteConfig} from '@angular/router-deprecated';
4+
//import {NS_ROUTER_DIRECTIVES, NS_ROUTER_PROVIDERS} from "nativescript-angular/router-deprecated/ns-router-deprecated";
5+
const NS_ROUTER_DIRECTIVES = [];
6+
37
import { Page} from "ui/page";
4-
import {NS_ROUTER_DIRECTIVES, NS_ROUTER_PROVIDERS} from "nativescript-angular/router-deprecated/ns-router-deprecated";
58
import {NS_DIRECTIVES} from "nativescript-angular/directives";
69

710
@Component({
@@ -84,10 +87,11 @@ class SecondComponent {
8487
</GridLayout>
8588
`
8689
})
87-
@RouteConfig([
88-
{ path: '/', component: FirstComponent, name: 'First' },
89-
{ path: '/second', component: SecondComponent, name: 'Second' },
90-
])
90+
//TODO: port to latest router
91+
//@RouteConfig([
92+
//{ path: '/', component: FirstComponent, name: 'First' },
93+
//{ path: '/second', component: SecondComponent, name: 'Second' },
94+
//])
9195
export class ActionBarTest {
9296
}
9397

ng-sample/app/examples/renderer-test.html

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
<StackLayout orientation='vertical'>
2+
<Label [text]='model.mydate | date:"fullDate"' [ngStyle]="{'background-color': 'lime'}"></Label>
23
<Progress value="50" style="color: red"></Progress>
3-
<!--<TimePicker [(ngModel)]='model.deliveryTime' ></TimePicker>
4-
<Label [text]='model.deliveryTime' ></Label>
5-
<DatePicker [(ngModel)]='model.deliveryDate' ></DatePicker>
6-
<Label [text]='model.deliveryDate' ></Label>-->
74
<SearchBar [(ngModel)]='model.search'></SearchBar>
85
<Label [text]='model.search' [style.backgroundColor]="'hotpink'"></Label>
9-
<Label [text]='model.mydate | date:"fullDate"' [ngStyle]="{'background-color': 'lime'}"></Label>
106
<Slider [(ngModel)]='model.sliderTest'></Slider>
117
<Label [text]='model.sliderTest'></Label>
128
<ListPicker [items]='model.listPickerItems' [(ngModel)]='model.selectedIndex'></ListPicker>

ng-sample/app/examples/renderer-test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class ProgressComponent {
2727

2828
@Component({
2929
selector: 'renderer-test',
30-
directives: [TemplatedComponent, ProgressComponent, TextValueAccessor, CheckedValueAccessor],
30+
directives: [TemplatedComponent, ProgressComponent],
3131
templateUrl: './examples/renderer-test.html'
3232
})
3333
export class RendererTest {
@@ -37,14 +37,16 @@ export class RendererTest {
3737
public moreDetailsText: string = "";
3838
public detailLines: Array<string> = [];
3939
public isValid: boolean = true;
40-
public model: Observable;
40+
public model: any;
41+
42+
public testModel = { mydate: new Date() };
4143

4244
constructor() {
4345
this.buttonText = 'Save...'
4446
this.showDetails = true;
4547
this.detailsText = 'plain ng-if directive \ndetail 1-2-3...';
4648
this.moreDetailsText = 'More details:';
47-
this.model = new Observable({
49+
this.model = {
4850
'test': 'Jack',
4951
'testBoolean': false,
5052
'deliveryDate': new Date(),
@@ -62,7 +64,7 @@ export class RendererTest {
6264
{'title': 'third'},
6365
{'title': 'fourth'}
6466
]
65-
});
67+
};
6668

6769
this.detailLines = [
6870
"ngFor inside a ngIf 1",

0 commit comments

Comments
 (0)