홈>
각도를 배우고 있습니다. '라우터 콘센트'는 알려진 요소가 아닙니다 '라는 오류가 발생했습니다. dashboard.component.ts, dashboard.module.ts, dashboard.component.html을 포함하여 하나의 폴더 대시 보드가 있습니다. 해당 파일의 코드는 다음과 같습니다.
dashboard.module.ts
------------------------------
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { DashboardComponent } from './dashboard.component';
import { AllBookListComponent } from './allbooklist.component';
@NgModule({
imports: [CommonModule],
declarations: [AllBookListComponent,DashboardComponent],
exports: [AllBookListComponent,DashboardComponent],
providers: [],
})
export class DashboardModule {
}
dashboard.component.ts
-----------------------------
import { Component } from '@angular/core';
@Component({
templateUrl: './dashboard.component.html',
})
export class DashboardComponent
{
}
dashboard.component.html
------------------------------------
<a routerLink="aaa" routerLinkActive="active">Home</a>
<router-outlet ></router-outlet>
app.module.ts
----------------------------
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { LoginModule } from './login/login.module';
import { DashboardModule } from './dashboard/dashboard.module';
import { routing } from './app.routing';
import { AppComponent } from './app.component';
@NgModule({
imports:[ BrowserModule,routing,LoginModule,DashboardModule],
declarations: [ AppComponent],
providers: [],
bootstrap: [ AppComponent ]
})
export class AppModule { }
app.routing.ts
-----------------------
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { LoginComponent } from './login/login.component';
import { DashboardComponent } from './dashboard/dashboard.component';
import { AllBookListComponent } from './dashboard
export const routing = RouterModule.forRoot([
{path: '', component: LoginComponent},
{ path: 'dashboard', component: DashboardComponent,
children: [
{ path: 'aaa', component: AllBookListComponent }
]
}
]);
app.component.ts
-------------------
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `<router-outlet></router-outlet>`,
})
export class AppComponent { name = 'Angular'; }
그러나 dashboard.module.ts 대신 app.module.ts에서 DashboardComponent ( './dashboard.component';에서 {DashboardComponent} 가져 오기)를 가져 오면 정상적으로 작동합니다. 내 질문은 마지막으로 dashboard.module.ts에서 app.module.ts로 가져 와서 dashboard.module.ts 대신 app.module.ts에서 DashboardComponent를 가져와야하는 이유입니다.
-
답변 # 1
관련 자료
- typescript typings - 각도 8 오류 '내 보낸 멤버'ɵBrowserPlatformLocation '이 없습니다'
- typescript - Angular 프로젝트 빌드 오류 "중복 식별자 'IteratorResult'"
- api - laravel 8 양식 유효성 검사가 작동을 멈추고 오류가 발생합니다
- 백엔드에 파일로 객체를 게시하는 방법은 무엇입니까? 415 오류 C #, 각도
- podman 컨테이너 정리 - 오류 : 컨테이너를 알 수 없음
- javascript - 오류를 발생시키기위한 하위 유형을 생성하려면 어떻게해야합니까?
- typescript - angular npm run prod - 오류 npm err! 누락 된 스크립트 : prod
- node.js - NodeJ의 Promise에서 catch 블록에서 오류를 던질 수 있습니까?
- html - 빈 th - fields에 대해 오류 메시지를 던지는 방법은 무엇입니까?
- rxjs - 여러 API 호출 중 각도 오류 처리
- typescript - 포착되지 않은 각도 오류 - 템플릿 구문 분석 오류 : 알려진 요소가 아닙니다
- 각도 템플릿을 동적으로 렌더링 할 때 오류를 포착하는 방법
- 서버를 시작하는 동안 오류를 표시하는 각도 CLI
- docker - $path에서 실행 파일을 찾을 수 없음 - 알 수없는 오류 메시지
- angular rxjs forkjoin 오류 - 정의되지 않은 '구독'속성을 읽을 수 없습니다
- 이온 각도 프록시 반환 오류 404를 찾을 수 없습니다
- Python의 사전에 동일한 키와 값이있는 경우 오류 메시지를 던지는 방법은 무엇입니까?
- 스테퍼를 각도로 재설정 할 때 오류가 발생합니다
- node.js - 새로운 Error ( 'record not found') 문을 던질 때 Nodejs 및 Mongoose 오류
- google chrome - Angular [innerHTML]로 TrustedHTML 할당 오류를 수정하는 방법
와이즈 비즈 가져 오기 와이즈 비즈
설명RouterModule
DashBoardMoule
의 일부입니다 구성 요소가<router-outlet>
에 액세스하려고합니다.RouterModule
를 포함하는 모듈router-outlet
를 가져 오지 않습니다DashBoardComponent