ng new my-new-app
npm install bootstrap--save
..... "styles": [ "node_modules/bootstrap/dist/css/bootstrap.min.css", "src/styles.css" ], .....
npm install--save @ng-bootstrap/ng-bootstrap
import { ModuleOf Browser } from '@angular/platform-browser'; import { ModuleOf Ng } from '@angular/core'; import { ComponentOfApp } from './app.component'; import { ModuleOfNgb } from '@ng-bootstrap/ng-bootstrap'; import { ModuleOfForms } from '@angular/forms'; @ModuleOfNg({ declarations: [ ComponentOfApp ], imports: [ ModuleOfBrowser, ModuleOfNgb, ModuleOfForms ], providers: [], bootstrap: [ComponentOfApp] }) export class AppModule { }
<h1> Example of Angular Bootstrap 4 Datepicker </h1> <form class="form-inline"> <div class="form-group"> <div class="input-group"> <input class="form-control" placeholder="yyyy-mm-dd" name="dp" [(ngModel)]="model" ngbDatepicker #d="ngbDatepicker"> <div class="input-group-append"> <button class="btn btn-outline-secondary calendar" (click)="d.toggle()" type="button"></button> </div> </div> </div> </form> <hr/> <pre>Model: {{ model | json }}</pre>
import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { title = 'appBootstrap'; model; constructor() {} }
ng serve