How can I migrate a web app with Angular v7 to mobile NativeScript app

北城余情 提交于 2019-12-06 14:53:33

As that document suggests as well, you have to create component.tns.html file as and other HTML elements are not available for mobile.

In your .tns.html file, you can replace with either StackLayout or GridLayout. You can refer to https://www.nslayouts.com/ to learn more about {NS} layouts.

in your weather-list.component.tns.html:

<StackLayout class="weather-list">
    <weather-item *ngFor="let weatherItem of weatherItems" [item]="weatherItem"></weather-item>
</StackLayout >

and in weather-item.component.tns.html

<StackLayout class="weather-element">
        <StackLayout>
            <Label text="{{ weatherItem.cityName }}"></Label>
            <Label text="{{ weatherItem.description }}"></Label>
        </StackLayout>
        <StackLayout>
            <Label text="{{ weatherItem.temperature }}"></Label>
        </StackLayout>
    </StackLayout>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!