다른 구성 요소에있는 두 가지 유형의 양식을 시각화하기 위해 SegmentedBar를 사용하려고합니다. 구성 요소에 대한 라우팅을 사용하여 부품을 모두 제거하고 막대 자체가 시각적으로 표시되지만 라우팅 부분 인 막대 시각화되지 않고 단지 비어 있습니다. 다른 구성 요소의Nativescript + Angular Segmented bar는 다른 구성 요소로 라우팅 할 수 없습니까?
하나는 유사합니다
<ScrollView>
<StackLayout>
<TextField [text]="first_name" hint="First Name" class="purplish label-marg"></TextField>
<TextField [text]="last_name" hint="Last Name" class="purplish label-marg"></TextField>
<TextField [text]="email" hint="Email" class="purplish label-marg"></TextField>
<TextField [text]="company_name" hint="Company name" class="purplish label-marg"></TextField>
<TextField [text]="company_position" hint="Position in company" class="purplish label-marg"></TextField>
<Label text="Company size" class="purpish label-marg font-weight-bold"></Label>
<ListPicker [items]="sizes"
[text]="company_size" class="p-15" ngDefaultControl>
</ListPicker>
<TextField [text]="company_resume" textWrap="true" hint="Company resume" class="purplish label-marg"></TextField>
<TextField [text]="year_of_creation" hint="Year of creation of the company" class="purplish label-marg"></TextField>
<Label text="Branch of the company" class="purpish label-marg font-weight-bold"></Label>
<ListPicker [items]="branches"
[text]="branch_company" class="p-15" ngDefaultControl>
</ListPicker>
<Label text="Country" class="purpish label-marg font-weight-bold"></Label>
<ListPicker [items]="countries" [text]="country" class="p-15" ngDefaultControl>
</ListPicker>
<TextField [text]="city" hint="City" class="purplish label-marg"></TextField>
<Label text="You can add job opening in your profile" class="purpish" margin-left="20px"></Label>
</StackLayout>
</ScrollView>
SegmentedBar 구성 요소의 XML/HTML :
<basictoolbar></basictoolbar>
<StackLayout>
<SegmentedBar #sb [items]="navItems" selectedIndex="0" (selectedIndexChange)="navigate(sb.selectedIndex)">
</SegmentedBar>
<router-outlet></router-outlet>
</StackLayout>
그리고 TS :
import { Component} from '@angular/core';
import { SegmentedBar, SegmentedBarItem } from "ui/segmented-bar";
import { Router } from '@angular/router';
import {ChangeDetectorRef,ApplicationRef} from '@angular/core';
@Component({
selector: 'cvformpage',
templateUrl: './components/cvformpage/cvformpage.component.html'
})
export class CvformpageComponent {
public navItems: Array<SegmentedBarItem>;
public constructor(private router: Router, private _applicationRef: ApplicationRef,private ref:ChangeDetectorRef) {
this.navItems = [];
this.navItems.push(this.createSegmentedBarItem("Employer Form"));
this.navItems.push(this.createSegmentedBarItem("Employee Form"));
}
private createSegmentedBarItem(title: string): SegmentedBarItem {
let item: SegmentedBarItem = new SegmentedBarItem();
item.title = title;
return item;
}
public navigate(index: number) {
switch(index) {
case 0:
console.log("I am here");
this.router.navigate(["/employer-form"]);
break;
case 1:
this.router.navigate(["/employee-form"]);
break;
}
}
}
내가 콘솔 그것을 시도 로그와 스위치 내부 및 오른쪽 케이스 내부에 도착하지만, 뭔가 라우팅이 엉망이됩니다. 나는 누군가가 나를 올바른 방법으로 도와 줄 수 있다면 선배들에게 감사한다.