无法在Angular2的父组件中使用子组件

无法在Angular2的父组件中使用子组件,angular,components,angular2-components,Angular,Components,Angular2 Components,我试图使用主组件中的子组件,使用主组件模板中的选择器使用app.component。但是它不起作用 child.component.ts import { Component} from '@angular/core'; @Component({ selector: 'child-component', templateUrl: `<p>Child Component</p>` }) export class ChildComponent { } import {

我试图使用主组件中的子组件,使用主组件模板中的选择器使用app.component。但是它不起作用

child.component.ts

import { Component} from '@angular/core';
@Component({
selector: 'child-component',
templateUrl: `<p>Child Component</p>`
})
export class ChildComponent  {  }
import { Component } from '@angular/core';
import { ChildComponent} from './child.component';

@Component({
selector: 'my-app',
template: `<h1>Hello Angular!</h1>
<child-component>    </child-component>       `
})

export class AppComponent { }
上提到的解决方案不起作用


请帮忙做个决定

您在
子组件
元选项中有输入错误

templateUrl: `<p>Child Component</p>`
templateUrl:`子组件

`
应该是

template: `<p>Child Component</p>`
模板:`子组件

`
非常感谢。它现在像魔术一样工作。请让我知道如何调试它。我没有成功地从终端/控制台跟踪它。浏览器控制台中的错误消息是解释性的,您应该首先查看它们
template: `<p>Child Component</p>`