无法将引导程序添加到Angular Project

我正在尝试将引导程序添加到我的有角项目中,但我无法这样做。我也没有任何错误。

我什至尝试了一些关于stackoverflow的解决方案。我正在使用Angular7。已经安装了bootstrap,jquery和popper.js。我也将它们添加到angular.json。

下面是我的 angular.json

    $url = $_SERVER['REQUEST_URI'];
    $url = explode('/',$url);
    $url = end(url);
    $param='some_value';

    active(); // call active unction

    function active() 
    {
        global $url,$param;
      // after using global keyword  $url,$param values replaced with empty by global keyword     
    }

以下是我在 AppModule.ts

中的导入语句
"styles": [
              "src/styles.css","./node_modules/bootstrap/dist/css/bootstrap.min.css"
            ],"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"],

我尚未将其包含在imports数组中。因为当我这样做时,出现以下错误

import { bootstrap } from 'bootstrap';

任何帮助将不胜感激。

eryaa 回答:无法将引导程序添加到Angular Project

不需要在您的 AppModule.ts 文件中导入引导程序,您可以使用引导程序类而不导入任何模块。因为您已经在 angular.json 文件

中导入了 bootstrap css和js 文件 ,
"./node_modules/jquery/dist/jquery.min.js","./node_modules/bootstrap/dist/js/bootstrap.min.js","./node_modules/popper.js/dist/umd/popper.min.js"

也许您为popper.js超出了另一个。 还要检查您的node_modules路径是否正确。

本文链接:https://www.f2er.com/3125938.html

大家都在问