Отказ от ответственности: я могу ошибаться в своем понимании этого вида, поскольку я использовал угловой только более года (Angular 16.0.0).
< H2> Code < /h2>
У меня есть этот компонент (Sidebarcomponent): < /p>
@Component({
selector: 'app-sidebar',
templateUrl: './sidebar.component.html',
styleUrls: ['./sidebar.component.scss']
})
export class SidebarComponent implements OnInit {
... // Not very relevant to the issue
}
< /code>
Этот боковой панель объявляется как часть модуля (Shellmodule): < /p>
@NgModule({
declarations: [
...,
SidebarComponent,
...
],
imports: [
CommonModule,
RouterModule,
... // Other necessary modules that are used in the sidebar
TranslatePipe,
],
exports: [
...,
SidebarComponent,
...
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class ShellModule {}
< /code>
Проблема < /h2>
Я ожидаю здесь, что компонент боковой панели может получить доступ к импорту из модуля, который объявляет его, и который включает в себя экспорт из Routermodule и TranslatePipe. < /p>
Примечание. Решение для импорта TransfortAteModule (.forChild ()) на самом деле не работает, я попробовал. Кроме того, я импортирую трубу только в других проектах, и она работает Dandy. class = "Lang-Bash PrettyPrint-Override">Error: src/app/components/shell/sidebar/sidebar.component.html:51:82 - error NG8004: No pipe found with name 'translate'.
51 {{'sidebar.' + sub_child.title | translate}}
src/app/components/shell/sidebar/sidebar.component.ts:11:18
11 templateUrl: './sidebar.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component SidebarComponent.
----------------------------------
Error: src/app/components/shell/sidebar/sidebar.component.html:48:51 - error NG8002: Can't bind to 'routerLinkActiveOptions' since it isn't a known property of 'span'.
48
Подробнее здесь: [url]https://stackoverflow.com/questions/79457268/why-dont-my-angular-components-realise-that-its-part-of-a-module[/url]
Отказ от ответственности: я могу ошибаться в своем понимании этого вида, поскольку я использовал угловой только более года (Angular 16.0.0). < H2> Code < /h2> У меня есть этот компонент (Sidebarcomponent): < /p> [code]@Component({ selector: 'app-sidebar', templateUrl: './sidebar.component.html', styleUrls: ['./sidebar.component.scss'] }) export class SidebarComponent implements OnInit { ... // Not very relevant to the issue } < /code> Этот боковой панель объявляется как часть модуля (Shellmodule): < /p> @NgModule({ declarations: [ ..., SidebarComponent, ... ], imports: [ CommonModule, RouterModule, ... // Other necessary modules that are used in the sidebar TranslatePipe, ], exports: [ ..., SidebarComponent, ... ], schemas: [CUSTOM_ELEMENTS_SCHEMA], }) export class ShellModule {} < /code> Проблема < /h2> Я ожидаю здесь, что компонент боковой панели может получить доступ к импорту из модуля, который объявляет его, и который включает в себя экспорт из Routermodule и TranslatePipe. < /p> Примечание. Решение для импорта TransfortAteModule (.forChild ()) на самом деле не работает, я попробовал. Кроме того, я импортирую трубу только в других проектах, и она работает Dandy. class = "Lang-Bash PrettyPrint-Override">Error: src/app/components/shell/sidebar/sidebar.component.html:51:82 - error NG8004: No pipe found with name 'translate'.
51 {{'sidebar.' + sub_child.title | translate}}
src/app/components/shell/sidebar/sidebar.component.ts:11:18 11 templateUrl: './sidebar.component.html', ~~~~~~~~~~~~~~~~~~~~~~~~~~ Error occurs in the template of component SidebarComponent.
---------------------------------- Error: src/app/components/shell/sidebar/sidebar.component.html:48:51 - error NG8002: Can't bind to 'routerLinkActiveOptions' since it isn't a known property of 'span'.