Nativescript angular 2 component 怎么来的?

Nativescript angular 2 component how to?

如何在 angular 1 中实现类似元素指令的组件?

这是我的代码,但它不起作用:

import {Component} from "@angular/core";

@Component({
    moduleId: "TestComponent",
    selector: "TestComponent",
    template: '<Label text="TEST COMPONENT" textWrap="true"></Label>'
})
export class TestComponentComponent {
    constructor() { }
}

@Component({
    selector: "my-app",
    template: `
    <StackLayout>
        <Label text="TEST"></Label>

        <TestComponent></TestComponent>
    </StackLayout>
    `
})
export class AppComponent {
    constructor() { }
}
import {registerElement} from "nativescript-angular/element-registry";
registerElement("third-party-view", () => require("./third-party-view").SimpleTag);

您可以阅读更多相关信息:https://docs.nativescript.org/angular/plugins/angular-third-party.html