0
很經典的情況下,我嘗試另一個模塊中使用的一些組件:angular2「不是一個已知的元素」的錯誤:一切都試過
外來元件:
import { Component, ViewEncapsulation,
ElementRef, ViewChild, Input, Output,
EventEmitter } from '@angular/core';
declare var __moduleName: string
@Component({
moduleId: __moduleName,
selector: 'bidule',
templateUrl: 'bidule.html',
styleUrls: [],
encapsulation: ViewEncapsulation.None
})
export class BiduleComponent {
@Input() config: { }
constructor(protected elRef: ElementRef) {
}
}
// template : <p>basic text</p>
外國模塊:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { BiduleComponent } from './bidule'
@NgModule({
imports: [
],
declarations: [
BiduleComponent
],
exports: [
BiduleComponent
]
})
export class BiduleModule {}
主要成分:
...
import { BiduleComponent } from '../../bidule/bidule'
...
// template : <bidule></bidule>
主要模塊:
import { BiduleModule } from '../../bidule/module'
// ...
@NgModule({
imports: [
// ...
BiduleModule
]
})
我相信我檢查一切:
https://stackoverflow.com/questions/44429996#44430230
如果您有任何想法。提前致謝。
(bidule是thingamajig一個法語單詞)
確實有疑問;我嘗試了/不。 – spin
問題仍然存在或您解決了它? – macvg
它仍然存在,否則我會驗證您的答案:) – spin