【发布时间】:2017-02-26 22:39:38
【问题描述】:
我刚开始学习 Angular2 并停留在需要组合 2 个组件的地方。
这是我的 app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: './app.component.html <app-home></app-home>',
styleUrls: ['./app.component.css']
})
export class AppComponent {
mylogo = 'ABC Engineering';
headlist = ["Home", "About", "Portfolio", "Pricing", "Contact"];
technology = ["HTML", "CSS", "JavaScript", "jQuery", "AngularJS", "PHP"];
}
这是我的 app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component';
import { AboutComponent } from './about/about.component';
@NgModule({
declarations: [
AppComponent,
HomeComponent,
AboutComponent,
],
imports: [
BrowserModule,
FormsModule,
HttpModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
它没有显示 app.component.html 的输出!但它确实显示了“home.component.html”中的内容。 如何修复它以显示“app.component.html”中的内容?
【问题讨论】:
标签: html css angular angular2-template