How to use bootstrap 4 in angular 2?

后端 未结 11 2584
有刺的猬
有刺的猬 2020-11-30 18:54

I\'m building an angular 2 app written in typescript. It would use the bootstrap 4 framework in combination with some custom theming, is this possible?

The \"ng2-boo

11条回答
  •  感动是毒
    2020-11-30 19:12

    First goto your project directory and follow the below given steps.

    1) npm install --save @ng-bootstrap/ng-bootstrap (run this command in node js command prompt)

    2)npm install bootstrap@4.0.0-alpha.6 (next run this)

    3)import {NgbModule} from '@ng-bootstrap/ng-bootstrap'(write this in app module.ts)

    4) If Module is your root module include this

    `@NgModule({
     declarations: [AppComponent, ...],
     imports: [NgbModule.forRoot(), ...],
     bootstrap: [AppComponent]
    })`
    
        (or)
    

    If not root Module

    `@NgModule({
     declarations: [OtherComponent, ...],
     imports: [NgbModule, ...]
    })`
    

    5) Write this in system.config.js

    `map: {
    '@ng-bootstrap/ng-bootstrap': 'node_modules/@ng-bootstrap/ng-
    bootstrap/bundles/ng-bootstrap.js',
    }`
    

    6) Add in Index.html

    `
     
     `
    

提交回复
热议问题