在解决Angular组件未从解析器初始化的问题时,可以尝试以下解决方法:
import { ComponentName } from 'path/to/component';
declarations: [
ComponentName
]
constructor(private service: SomeService) { }
const routes: Routes = [
{ path: 'component-path', component: ComponentName }
];
如果以上解决方法仍未解决问题,可以尝试重新编译应用程序或重新启动开发服务器。
上一篇:Angular组件未被渲染。
下一篇:Angular组件未对齐