简体   繁体   English

如何使用带有角度cli的自举网格?

[英]How can I use bootstrap grid with angular cli?

I made: 我做了:

npm install ng2-bootstrap --save

then opened angular-cli-build.js and added this line 然后打开angular-cli-build.js并添加了这一行

vendorNpmFiles: [
       ..................
       'ng2-bootstrap/**/*.js',
        ....................
      ]

Wrote in src/system-config.ts 在src / system-config.ts中写道

const map:any ={
         ..................
       'ng2-bootstrap': 'vendor/ng2-bootstrap',
        ....................

    }

and

 const packages: any = {
      'ng2-bootstrap': {
        format: 'cjs',
        defaultExtension: 'js',
        main: 'ng2-bootstrap.js'

      }

    };

But without the link from cdn 但是没有来自cdn的链接

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

I can't use styles Bootstrap. 我不能使用样式Bootstrap。 Can I do something with it? 我可以用它做点什么吗?

ng2-bootstrap module is a bundle of Angular 2 components and directives which replaces the default bootstrap javascript. ng2-bootstrap模块是一组Angular 2组件和指令,它取代了默认的bootstrap javascript。 This means you don't need to include bootstrap javascript and jQuery in your Angular 2 application. 这意味着您不需要在Angular 2应用程序中包含bootstrap javascript和jQuery。

This module does not include bootstrap css. 此模块不包括bootstrap css。 You will still need to include it in some way and the easiest solution is to add the cdn in your application. 您仍然需要以某种方式包含它,最简单的解决方案是在您的应用程序中添加cdn。 ng2-bootstrap will work perfectly with the default bootstrap css. ng2-bootstrap将与默认的bootstrap css完美配合。

To include the bootstrap css you will need to add the following line to src/index.html: 要包含bootstrap css,您需要将以下行添加到src / index.html:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM