我现在很困惑。尝试以这种方式显示组件:
<popup-standard></popup-standard>
弹出-standard.component.ts
@Component({
selector: "[popup-standard]",
templateUrl: "./standard.template.html"
})
export class PopupStandardComponent { }
popups.module.ts
@NgModule({
declarations: [
PopupStandardComponent,
],
exports: [
PopupStandardComponent
]
})
export class PopupsModule { }
在我的模块imports
中添加了PopupsModule:
@NgModule({
imports: [
CommonModule,
ROUTES,
RouterModule,
PopupsModule,
MockModule
],
declarations: [
ChatComponent,
LayoutComponent
],
})
显示两个错误:
即使我将模式CUSTOM_ELEMENTS_SCHEMA添加到我的模块,错误也消失了,但即使有一些HTML代码等,组件也是空的。
这里是包依赖:
"@angular/animations": "^4.2.6",
"@angular/cdk": "^2.0.0-beta.8",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"core-js": "^2.4.1",
"hammerjs": "^2.0.8",
"jquery": "^3.1.0",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
我认为我正在以正确的方式做到这一点,但不知怎的,它并没有。 提前谢谢。
答案 0 :(得分:2)
应该只是
@Component({
selector: "popup-standard",
templateUrl: "./standard.template.html"
})