Skip to content

Commit 2d2970e

Browse files
Include binding test page
1 parent 6692dc3 commit 2d2970e

File tree

3 files changed

+77
-0
lines changed

3 files changed

+77
-0
lines changed

app/binding/binding-page.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import {Component} from "@angular/core";
2+
3+
@Component({
4+
selector: "binding",
5+
templateUrl: 'binding/binding-page.xml'
6+
})
7+
8+
export class BindingComponent {
9+
private _oneWayDataBinding: string;
10+
private _twoWayDataBinding: string;
11+
private _curlyBracket: string;
12+
private _result: string;
13+
14+
constructor() {
15+
this.refresh();
16+
}
17+
18+
get oneWayDataBinding() {
19+
return this._oneWayDataBinding;
20+
}
21+
22+
get twoWayDataBinding() {
23+
return this._twoWayDataBinding;
24+
}
25+
26+
set twoWayDataBinding(value: string) {
27+
this._twoWayDataBinding = value;
28+
}
29+
30+
get curlyBracket() {
31+
return this._curlyBracket;
32+
}
33+
34+
set curlyBracket(value: string) {
35+
this._curlyBracket = value;
36+
}
37+
38+
get results() {
39+
return this._result;
40+
}
41+
42+
changeValues() {
43+
this._oneWayDataBinding = this.twoWayDataBinding;
44+
this._curlyBracket = this.twoWayDataBinding;
45+
this._twoWayDataBinding = this.twoWayDataBinding;
46+
}
47+
48+
getValues() {
49+
this._result = "";
50+
this._result += "one-way value is " + this.oneWayDataBinding + "; \n";
51+
this._result += "two-way value is " + this.twoWayDataBinding + "; \n";
52+
this._result += "curly-bracket value is " + this.curlyBracket + "; \n";
53+
}
54+
55+
private refresh() {
56+
this._oneWayDataBinding = "one-way";
57+
this._twoWayDataBinding = "two-way";
58+
this._curlyBracket = "curly-bracket";
59+
this._result = ""
60+
}
61+
}

app/binding/binding-page.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<StackLayout>
2+
<TextField hint="oneWayDataBinding" automationText="tfOneWayBinding" keyboardType="email" [text]="oneWayDataBinding" autocorrect="false" autocapitalizationType="none"></TextField>
3+
<TextField hint="twoWayDataBindingBanana" automationText="tfTwoWayBinding" keyboardType="email" [(ngModel)]="twoWayDataBinding" autocorrect="false" autocapitalizationType="none"></TextField>
4+
<TextField hint="" automationText="tfCurlyBracket" keyboardType="email" text="{{ curlyBracket }}" autocorrect="false" autocapitalizationType="none"></TextField>
5+
<Label automationText="lbCurlyBracketBinding" text='Label with curlyBaracket binding: {{ twoWayDataBinding }}'></Label>
6+
<StackLayout orientation="horizontal">
7+
<Button (tap)="changeValues()" automationText="btnSaveChanges" text="update" width="80" height="40"></Button>
8+
<Button (tap)="getValues()" automationText="getValues" text="get" width="80" height="40"></Button>
9+
</StackLayout>
10+
<TextView [text]="results" automationText="tvResults" textWrap="true"></TextView>
11+
</StackLayout>

app/main/main-page-router-outlet.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {AppComponent} from "../template/app.component";
88
import {FirstComponent} from "../components/first.component";
99
import {SecondComponent} from "../components/second.component";
1010
import {NavigationTestRouter} from "../router/router-outlet";
11+
import {BindingComponent} from "../binding/binding-page";
1112

1213
@Component({
1314
selector: "main",
@@ -24,6 +25,7 @@ import {NavigationTestRouter} from "../router/router-outlet";
2425
<Button text="ActionBar1" [nsRouterLink]="['FirstActionBar']"></Button>
2526
<Button text="ActionBar2" [nsRouterLink]="['SecondActionBar']"></Button>
2627
</StackLayout>
28+
<Button text="Binding" [nsRouterLink]="['Binding']"></Button>
2729
</StackLayout>
2830
`,
2931
})
@@ -43,5 +45,8 @@ class MainComponent { }
4345
{ path: '/action-bar-test/...', component: ActionBarTest, name: 'ActionBar' },
4446
{ path: '/first-action-bar', component: FirstComponentActionBar, name: 'FirstActionBar' },
4547
{ path: '/second-action-bar', component: SecondComponentActionBar, name: 'SecondActionBar' },
48+
{ path: '/binding', component: BindingComponent, name: 'Binding' },
49+
50+
4651
])
4752
export class NavigationMainPageRouter { }

0 commit comments

Comments
 (0)