나는 A A nativescript 사용자 지정 구성 요소 http://moduscreate.com/custom-components-in-nativescript/을 만들려면이 가이드를 따라했지만 내가 폴더를이 주요라는 내부 폴더와 페이지이 나Nativescript 사용자 정의 구성 요소
을 위해 작동하지 않습니다. 주요 파일
main.html의 몇 가지를 가지고
<StackLayout
xmlns="http://schemas.nativescript.org/tns.xsd"
xmlns:hello="pages/helllo"
loaded="pageLoaded" >
<hello:hello/>
</StackLayout>
main.component.ts
import { Component, ElementRef, OnInit, ViewChild} from "@angular/core";
import { Page } from "ui/page";
import colorModule = require("color");
var Color = colorModule.Color;
@Component({
selector: "my-app",
templateUrl: "pages/main/main.html",
styleUrls: ["pages/main/main-common.css"]
})
export class MainComponent implements OnInit{
constructor(private page: Page) {
}
ngOnInit() {
this.page.actionBarHidden = true;
}
}
나는 또한 메인 common.css이 그러나 그것은 중요하지 않습니다. 그때 나는 내가 무엇을
<StackLayout width="100%" height="100%" backgroundColorr="red">
<Label class ="h1" text="h1 hello world" color="black"></Label>
<Label class ="h1" text="h1 hello world" color="black"></Label>
<Label class ="h1" text="h1 hello world" color="black"></Label>
<Label class ="h1" text="h1 hello world" color="black"></Label>
<Label class ="h1" text="h1 hello world" color="black"></Label>
<Label class ="h1" text="h1 hello world" color="black"></Label>
<Label class ="h1" text="h1 hello world" color="black"></Label>
<Label class ="h1" text="h1 hello world" color="black"></Label>
<Label class ="h1" text="h1 hello world" color="black"></Label>
<Label class ="h1" text="h1 hello world" color="black"></Label>
<Label class ="h1" text="h1 hello world" color="black"></Label>
</StackLayout>
는 안녕 구성 요소에 상관없이 보여주는되지 그러나 hello.html
그 안에 하나의 파일로 안녕하세요라는 페이지 안에 다른 폴더가 빈 화면 만 나타납니다. 나는 또한이 라인을 변경하려고 시도했다 xmlns:hello="pages/helllo"
hello.html이 파일에 xmlns:hello="../helllo"
하지만 아무것도 얻지 못했습니다 심지어 오류. 누군가 내가 잘못하고있는 것을 지적 할 수 있습니까?
사용자 정의 구성 요소 당신이 그것을 같은 각도 공유 일 필요 각도 만 바닐라 NS에서 작동하지 않도록 뭐죠 난 바닐라 NS 또는 각도를 사용하는 것이 좋습니다 어떤 각도 –
를 사용하지 않는로 불리는이? –
각각 장단점이 있습니다. 동일한 문제가있는 바닐라를 사용하고 있습니다. NS로 시작했지만 ng2가 익숙하거나 웹 사이트의 로직을 재사용해야하는 경우 오류가 발생하는 더 많은 것들이 있습니다. –