創建RPG角色創建者。其他組件內的角度2組件
我有一個NewCharacterComponent,我試圖在它內部實現一個DieInputComponent。 NewCharacterComponent從AppComponent路由。代碼的重要代碼片段如下。
我遇到的問題是,我沒有得到在NewCharacterComponent中加載DieInputComponent。當我打破DieInputComponent代碼時,在控制檯中沒有引發錯誤,所以錯誤可能是我沒有成功導入DieInputComponent,但我不知道發生了什麼問題。
新character.component.ts
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router-deprecated';
import { DieInputComponent } from './die-input.component';
@Component({
selector: 'core-worlds',
templateUrl: 'app/new-character.component.html',
styleUrls: ['app/new-character.component.css'],
})
export class NewCharacterComponent {
constructor() { }
}
新character.component.html
<h2>New Character</h2>
<die-input></die-input>
芯片input.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'die-input',
templateUrl: 'app/die-input.component.html',
styleUrls: ['app/die-input.component.css'],
})
export class DieInputComponent {
constructor() { }
}
模輸入。 component.html
<input type="number" placeholder="1d4"></input>
真棒,這WOR糟透了。我已經完成了Tour of Heroes教程,但我不認爲我已經真正掌握了指令實際上做了什麼。 – Crimthann
可悲的是,現在已經失去了根據,我們現在必須在我們的模塊中使用一個聲明 –