У меня есть следующая структура моего приложения:
app
|-- author
|-- |-- posts
|-- |-- |-- posts.component.html
|-- |-- author.component.html
|--
|-- components
|-- |-- tag
|-- |-- |-- tag.component.ts
|-- home
|-- |-- home.component.html
|-- |-- ...
|-- ...
app.module.ts
graphql.module.ts
Проблема в том, что я могу получить доступ к своему components/tag
компоненту в home.component.html
, но не могу получить к нему доступ в author/posts/posts.component.html
и даже в author/author.component.html
.
Я импортировал компонент tag
в мой файл app.module.ts
и отлично работает для дома. Я не могу обнаружить проблему!
Пожалуйста, помогите мне решить ее
Редактировать: app.module.ts
import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";
import { CommonModule } from "@angular/common";
//& Root
import { AppRoutingModule } from "./app-routing.module";
import { AppComponent } from "./app.component";
//& Components
import { TagComponent } from "./components/tag/tag.component";
//& Routes
import { HomeComponent } from "./home/home.component";
@NgModule({
declarations: [
AppComponent,
//& Routes
HomeComponent,
//& Components
TagComponent
],
imports: [
//& Essential Modules
CommonModule,
BrowserModule,
AppRoutingModule,
GraphQLModule,
HttpClientModule,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
home.component.html
, posts.component.html
<tag></tag>