我試圖在我的GettingStartedPage
組件中顯示OAuthComponent
。在投放到我的瀏覽器時,OAuthComponent
未顯示。沒有錯誤。Angular 2組件未顯示
OAuthComponent.ts
import {Page, NavController} from 'ionic/ionic';
import {Component} from 'angular2/angular2'
@Component({
templateUrl: "app/authentication/components/oauth-component.html",
selector: "oauth-component"
})
export class OAuthComponent {
private nav: NavController;
constructor(nav: NavController) {
this.nav = nav;
}
}
oauth-component.html
<h1>
Testing Something
</h1>
GettingStartedPage.ts
import {Page, NavController} from 'ionic/ionic';
import {OAuthComponent} from "../authentication/components/OAuthComponent";
import "./getting-started.scss";
@Page({
templateUrl: 'app/getting-started/getting-started.html',
directives: [OAuthComponent]
})
export class GettingStartedPage {
private nav: NavController;
constructor(nav: NavController) {
this.nav = nav;
}
}
getting-started.html
<ion-navbar *navbar>
<a menu-toggle>
<icon menu></icon>
</a>
<ion-title>Getting Started</ion-title>
</ion-navbar>
<ion-content>
<main>
<oauth-component></oauth-component>
</main>
</ion-content>
新增'指令:[OAuthComponent]'和導入。它仍然沒有工作。修改我原來的帖子以包含指令更改。 – prolink007