Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Nativescript:如何创建类似角度routerlink的行为_Nativescript_Angular2 Nativescript - Fatal编程技术网

Nativescript:如何创建类似角度routerlink的行为

Nativescript:如何创建类似角度routerlink的行为,nativescript,angular2-nativescript,Nativescript,Angular2 Nativescript,现在我有了这个组件,它是一个搜索功能组件: 下面是它的代码: <StackLayout> <StackLayout class="form"> <StackLayout class="input-field"> <TextField hint="Tournament Name" [(ngModel)]="query"></TextField> </StackLayo

现在我有了这个组件,它是一个搜索功能组件:

下面是它的代码:

<StackLayout>
    <StackLayout class="form">
        <StackLayout class="input-field">
            <TextField hint="Tournament Name" [(ngModel)]="query"></TextField>
        </StackLayout>
        <Button text="Search" (tap)="onSubmit()"></Button>
    </StackLayout>
    <Scrollview height="80%">
        <StackLayout>
            <GridLayout *ngFor="let result of results" (tap)="onTap(result.tournament_id)" columns="*, *" rows="auto, auto, auto, auto, auto, auto" borderWidth="1px">
                <Label  [text]="result.name" row="0" col="0" colspan="2" ></Label>
                <Label  [text]="result.organization" row="1" col="0" colspan="2" ></Label>
                <Label  [text]="result.date" row="2" col="0" ></Label>
                <Label  [text]="result.time" row="2" col="1" ></Label>
                <Label  [text]="result.game" row="3" col="0" colspan="2" ></Label>
                <Label  [text]="result.style" row="4" col="0" colspan="2" ></Label>
                <Label  [text]="result.location" row="5" col="0" colspan="2" textWrap="true"></Label>
            </GridLayout>
        </StackLayout>
    </Scrollview>
</StackLayout>
单击框时,它会打印出:

tapped {id} //first click
true
tapped {id} //subsequent clicks
null

如何在nativescript应用程序中创建类似web routerlink的角度行为,在该应用程序中,单击对象会显示另一个组件?

您应该使用文档中讨论的
nsRouterLink

tapped {id} //first click
true
tapped {id} //subsequent clicks
null