【问题标题】:Integrate simple bootstrap template into Angular将简单的引导模板集成到 Angular 中
【发布时间】:2021-12-14 13:55:12
【问题描述】:

我使用ng new test-app 创建了一个新的 Angular 应用程序。现在我想使用这个非常基本的模板Start Bootstrap

我该怎么做?

到目前为止我做了什么:

  1. 我执行了npm install bootstrap
  2. 我将node_modules/bootstrap/dist/css/bootstrap.css 添加到angular.json 文件中

据我所知,我现在拥有所有可用的东西。现在我只是将<body>...</body>html-Template 复制到app.component.html,但我用jQuery 脚本删除了底部的东西。

好吧,结果是它看起来很相似,但远非美好。我究竟做错了什么?有什么遗漏吗?

【问题讨论】:

    标签: angular bootstrap-4 frontend


    【解决方案1】:

    好的,解决方法很简单:

    1. 我忘记将引导脚本添加到angular.json。所以我在脚本中添加了node_modules/bootstrap/dist/js/bootstrap.js

    2. 我在安装 bootstrap5 时使用了 bootstrap4 模板。所以我切换到了 bootstrap5 模板。

    一切正常!

    注意:显然你必须检查模板是否有一些额外的css设置或一些额外的包。

    【讨论】:

    • 好吧,你自己解决了 :) 但是如果在 angular.json 文件中再次更改,别忘了重启应用程序。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-12-07
    • 2019-12-14
    • 1970-01-01
    • 1970-01-01
    • 2015-08-31
    • 2016-06-17
    • 1970-01-01
    相关资源
    最近更新 更多