angular ng-template 使用 nativescript 真的很奇怪

angular ng-template with nativescript is really weird buggy

抱歉,标题不是那么具体,但从 angular + NS 开始,我遇到了很多奇怪的异常行为,这让我很惊讶。

有效好的:

<StackLayout>
    <ListView [items]="items" class="list-group">
        <ng-template let-item="item">
             <Label [nsRouterLink]="['/item', item.id]" [text]="item.name" class="list-group-item"></Label>

        </ng-template>
    </ListView>
</StackLayout>

有效无效:(没有收到具体的异常消息,只是 getView 调用失败...非常感谢...)

<StackLayout>
    <ListView [items]="items" class="list-group">
        <ng-template let-item="item">
            <Label [nsRouterLink]="['/item', item.id]" [text]="item.name" class="list-group-item"></Label>
                <b>shit</b>           
        </ng-template>
    </ListView>
</StackLayout>

部分有效:(这里也不例外,但粗体字 shit 不可见)

<ListView [items]="items" class="list-group">
    <ng-template let-item="item">
        <StackLayout> <Label [nsRouterLink]="['/item', item.id]" [text]="item.name" class="list-group-item"></Label>
            <b>shit</b>
        </StackLayout>
    </ng-template>
</ListView>

为什么会在如此混乱的情况下产生这些代码?

我对listview的理解还不够吗?我在这里错过了什么?

可能的情况是像 bold-tag 这样的 html 标签似乎不允许在与 NS 一起使用的 ng-template 中使用 button/datepicker NS_angular组件也不起作用,导致 getView 内部出现异常...

更新 1

好吧,我刚发现我不能在里面放一个以上的元素 ng-template 一切都崩溃了哦拜托,这是多么糟糕的工具行为!!!

在 Label 和 Button 周围放置一个 StackPanelLayout 然后它被渲染!

我想用 NS + angular 我可以用 angular 编码,我已经习惯了,只是有一个 NS 包装器,不会打扰我。不过好像NS要学很多,里面放的知识很少angular,比较失望。

我建议您阅读 {N} 文档的基础知识以避免进一步的混淆。

您的应用在这里完全是原生的,因此您不能使用特定于网络浏览器的 HTML 标签。您必须使用标准的 {N} UI 小部件,要使文本加粗,您必须使用 fontWeight 属性 或 font-weight in CSS. If you like part of your text to be bold then you suppose to use FormattedString.