返回

core.mjs:14631 NG0304:“应用程序提取”不是已知元素:

发布时间:2022-09-02 21:48:37 401
# css# html# bootstrap# angular# 服务器

我用 ionic cli 生成了一个组件:

import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-extraction',
  templateUrl: './extraction.component.html',
  styleUrls: ['./extraction.component.scss'],
})
export class ExtractionComponent implements OnInit {

  constructor() { }

  ngOnInit() {}

}

然后我在 app.module 中声明了它:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';

import { IonicModule, IonicRouteStrategy } from '@ionic/angular';

import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { ItemModule } from 'src/app/modules/item/item.module';
import { DynamicFormModule } from 'src/app/modules/dynamic-form/dynamic-form.module';
import { HelpersModule } from 'src/app/modules/helpers/helpers.module';
import { UserModule } from './modules/user/user.module';
import { SelectorItemsPage } from './modules/item/pages/selector-items/selector-items.page';
import { EditUserPage } from './modules/user/pages/edit-user/edit-user.page';
import { ProfilePage } from './modules/user/pages/profile/profile.page';
import { ExtractionComponent } from './components/extraction/extraction.component';

@NgModule({
  declarations: [
    AppComponent,
    SelectorItemsPage,
    EditUserPage,
    ProfilePage,
    ExtractionComponent,
   ],
  entryComponents: [],
  imports: [
    BrowserModule,
    IonicModule.forRoot(),
    AppRoutingModule,
    DynamicFormModule,
    ItemModule,
    HelpersModule,
    UserModule,
    ],
  providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }],
  bootstrap: [AppComponent],
  exports:[
  ]
})
export class AppModule {}

启动开发服务器时,出现以下错误:

NG0304: 'app-extraction' is not a known element:
1. If 'app-extraction' is an Angular component, then verify that it is part of this module.
2. If 'app-extraction' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

我读过很多关于这个错误的帖子,但都没能修复它

特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(2)
按点赞数排序
用户头像