且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

相对路径在Angular2组件中不起作用

更新时间:2023-02-09 23:22:27

问题可能来自moduleId should be a string in "NavbarComponent".

由于Angular CLI现在使用Webpack,因此Webpack中的module.id是一个数字,而Angular需要一个字符串.您应该做的是删除moduleId元数据.

As Angular CLI now use Webpack, module.id in Webpack is a number, while Angular expects a string. What you should do is remove the moduleId metadata.

@Component({
  selector: 'app-navbar',
  templateUrl: './navbar.component.html',
  styleUrls: ['./navbar.component.css']
})