[英]Can't bind to property since it isn't a known property of a component
SnackBar
组件应在Shared
模块中声明并导出。
@NgModule({
// ...
declarations: [ SnackBarComponent ],
exports: [ SnackBarComponent ],
// ...
})
export class SharedModule { }
Shared
模块应导入到Main
模块中。 ( 角度 )
@NgModule({
// ...
imports: [ SharedModule ],
// ...
})
export class MainModule { }
您需要将shared
模块添加到main
模块imports
列表中。 仅在文件顶部将其引用为import
是不够的。 参见Angular文档: https : //angular.io/guide/sharing-ngmodules
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.