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