Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 向Angular 8添加引导_Javascript_Jquery_Css_Angular_Frontend - Fatal编程技术网

Javascript 向Angular 8添加引导

Javascript 向Angular 8添加引导,javascript,jquery,css,angular,frontend,Javascript,Jquery,Css,Angular,Frontend,我正在尝试将引导添加到我的Angular应用程序中。我是新手,虽然按照要求的步骤安装引导程序时遇到了问题 我完成了安装Angular cli、ng new first app和ng serve的所有必要步骤 我打开vs代码终端并尝试使用 npm安装引导程序-保存 然后将其添加到style.css中 @导入~bootstrap/dist/css/bootstrap.css 但是,当我点击悬停在上述代码段上的链接时,仍然会显示“找不到文件”,并提示使用此路径创建文件。欢迎使用StackOverflo

我正在尝试将引导添加到我的Angular应用程序中。我是新手,虽然按照要求的步骤安装引导程序时遇到了问题

我完成了安装Angular cli、ng new first app和ng serve的所有必要步骤

我打开vs代码终端并尝试使用

npm安装引导程序-保存

然后将其添加到style.css中

@导入~bootstrap/dist/css/bootstrap.css


但是,当我点击悬停在上述代码段上的链接时,仍然会显示“找不到文件”,并提示使用此路径创建文件。

欢迎使用StackOverflow

引导不是TypeScript代码,所以您不需要将其导入。相反,它是CSS代码,因此您希望将其作为一个文件导入index.html文件中`

下面是我如何在我的应用程序中导入boostrap-下面是index.html的标签


欢迎来到StackOverflow

引导不是TypeScript代码,所以您不需要将其导入。相反,它是CSS代码,因此您希望将其作为一个文件导入index.html文件中`

下面是我如何在我的应用程序中导入boostrap-下面是index.html的标签


如果您只想从引导添加样式,angular.json文件中有一个属性允许您将其包含在构建中

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "projects": {
    "yourproject": {
      "architect": {
        "build": {
          "options": {
            "styles": [
              "src/styles.scss",
              "node_modules/bootstrap/dist/css/bootstrap.min.css"
            ]
          },
        ...


请参阅:

如果您只想从引导添加样式,angular.json文件中有一个属性允许您将其包含在构建中

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "projects": {
    "yourproject": {
      "architect": {
        "build": {
          "options": {
            "styles": [
              "src/styles.scss",
              "node_modules/bootstrap/dist/css/bootstrap.min.css"
            ]
          },
        ...


请参阅:

添加引导的简单方法是使用Angular CLInpm安装

从命令行界面安装引导并在angular.json中引用它

npm install bootstrap --save

添加引导的一个简单方法是使用Angular CLInpm安装

从命令行界面安装引导并在angular.json中引用它

npm install bootstrap --save
在style.css文件中添加以下行,该文件位于项目内的src文件夹下

@import '~bootstrap/dist/css/bootstrap.min.css';
在style.css文件中添加以下行,该文件位于项目内的src文件夹下

@import '~bootstrap/dist/css/bootstrap.min.css';

或者可以从angular json文件导入样式数组,如node_modules/bootstrap/dist/css/bootstrap.min.css。在Angular中是导入它的常用方法。或者可以从Angular的json文件导入到样式数组中,如:node_modules/bootstrap/dist/css/bootstrap.min.css。在Angular中是导入它的常用方式。