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
The options above will work, however I use this approach via NPM:
Run the NPM command obtained from step 1 in your project i.e
npm install bootstrap@4.0.0-alpha.5 --save
After installing the above dependency run the following npm command which will install the bootstrap module
npm install --save @ng-bootstrap/ng-bootstrap
You can read more about this here
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
and add NgbModule
to the imports
Your app module will look like this:
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
@NgModule({
declarations: [
AppComponent,
WeatherComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
NgbModule.forRoot(), // Add Bootstrap module here.
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Open angular-cli.json and insert a new entry into the styles array :
"styles": [
"styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.min.css"
],
Open src/app/app.component.html and add
hello
or if you would like to use ng alert then place the following on your app.component.html page
I'm a dismissible alert :)
Now run your project and you should see the bootstrap alert message in the browser.
NOTE: You can read more about ng Components here