我正在尝试使用Angular 6,Bootstrap 4和Visual Studio 2017构建POC,以便我以后可以在实际应用程序中使用它 . 这是我到目前为止所做的 .

  • 跟随this tutorial on youtube并且我已经编译和工作了Angular 6的Asp.Net Core项目 .

  • npm install bootstrap @ latest jquery @ latest popper.js@latest

  • 更新了angular.json以添加样式和脚本

“styles”:[“src / styles.scss”],“scripts”:[“node_modules / jquery / dist / jquery.min.js”,“node_modules / popper.js / dist / umd / popper.min.js” ,“node_modules / bootstrap / dist / js / bootstrap.min.js”]

  • 导入的bootstrap scss文件到styles.scss [@import“node_modules / bootstrap / scss / bootstrap.scss”;]

  • ng build

  • dotnet运行

问题:

  • 在哪里添加导航栏,index.html或app.components.html的代码?我认为index.html在app-root之前,但我不确定 .

  • 当我尝试使用bootstrap类添加导航栏时,Visual Studio会抱怨Unknown css类 . 我想是因为没有引用wwwroot文件夹中的styles.css . 那么如何从scss编译为css并将其导入wwwroot文件夹 . 我尝试过使用Gulp,但是我在每次构建之前手动运行它,而"ng build"命令删除了从Gulp生成的那些css文件 .

这就是我当前项目的样子 .

enter image description here