You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular 5 Karma测试报错:'app-addbook'不是已知元素

Got it, let's organize your Angular book component setup clearly with proper formatting:

Angular Book Component Setup

File Structure

Here's the full list of files you have under /src/app/book/:

  • book.component.ts
  • book.module.ts
  • book.component.html
  • book-routing.module.ts
  • addbook.component.html
  • addbook.component.ts

book.component.html Code

<button class="btn btn-outline-success" (click)="addButton()">Add Book</button>
<div *ngIf="toggleFlag">
  <app-addbook></app-addbook>
</div>

Partial book.module.ts Code

Looks like you shared a snippet of this file, here's the formatted version:

@NgModule({
  imports: [
    CommonModule,
    ReactiveFormsModule,
    Book...

内容的提问来源于stack exchange,提问作者Niladri Banerjee - Uttarpara

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 10:39:22