Skip to content
  • About Us
  • Contact Us
  • Privacy Policy
  • Terms & Conditions
  • Site Map

XpertPhp

Expertphp Is The Best Tutorial For Beginners

  • Home
  • Javascript
    • Jquery
    • React JS
    • Angularjs
    • Angular
    • Nodejs
  • Codeigniter
  • Laravel
  • Contact Us
  • About Us
  • Live Demos
Angular 10 Bootstrap 4 Timepicker Example

Angular 10 Bootstrap 4 Timepicker Example

Posted on October 1, 2020September 26, 2021 By XpertPhp No Comments on Angular 10 Bootstrap 4 Timepicker Example

In this tutorial, we will explain to you how to create a bootstrap 4 timepicker in angular 10(Angular 10 Bootstrap 4 Timepicker Example). here we will use the ngx-bootstrap package for bootstrap 4 timpicker.

The ngx-bootstrap package is part of the bootstrap. the bootstrap provides many UI facilities like timepicker, model, button, etc. so we can easily install and use this package in our application.

Create new angular app

We will create a new angular app using the following command.

1
2
ng new timepicker-example
cd timepicker-example

Install bootstrap 4 in angular

After the complete created application, you can install the bootstrap using the below command.

1
npm install bootstrap --save

now, we will install the ng bootstrap package using the following command.

1
npm install --save @ng-bootstrap/ng-bootstrap

We need to add the bootstrap CSS and NGX Datepicker path into the angular.json file. so first we will add that path into the angular.json file.
angular.json

1
2
3
4
5
"styles": [
     "node_modules/bootstrap/dist/css/bootstrap.min.css",
     "node_modules/ngx-bootstrap/datepicker/bs-datepicker.css",
     "src/styles.css"
]

Import module in angular

In this step, we need to add a module into the src/app/app.module.ts file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
 
import { AppComponent } from './app.component';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { FormsModule } from '@angular/forms';
 
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    NgbModule,
    FormsModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Update view file in angular

In this step, we will create the ngb-timepicker field. so you can see the below example.
src/app/app.component.html

1
2
3
4
5
6
7
8
9
<div class="container">
  <h2>Angular 10 Bootstrap 4 Timepicker Example</h2>
  <ngb-timepicker [(ngModel)]="time"></ngb-timepicker>
  
  <hr/>
  
  <pre>Selected time: {{time | json}}</pre>
</div>

Update component in angular

src/app/app.component.ts

1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { Component } from '@angular/core';
 
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'timepicker-example';
  
  time = {hour: 14, minute: 30};
 
  constructor() {}
}

Run Our Angular Application

Now we will run our Angular application using the below command.

1
ng serve

Please follow and like us:
error
fb-share-icon
Tweet
fb-share-icon

Recommended Posts:

  • Angular 10 Form Validation Example Tutorial
  • Angular 10 Custom Validation Tutorial with Example
  • angular 10 file upload example tutorial
  • Angular 11 Create Component Example
  • How to add font awesome in angular 11
Angular Tags:angular datetime picker, angular timepicker

Post navigation

Previous Post: Laravel 8 Elasticsearch Integration From Scratch With Example
Next Post: Laravel 8 Integrate Ckeditor With Example

Categories

  • Ajax
  • Angular
  • Angularjs
  • Bootstrap
  • Codeigniter
  • Css
  • Htaccess
  • Javascript
  • Jquery
  • Laravel
  • MongoDB
  • MySql
  • Nodejs
  • Php
  • React JS
  • Shopify Api
  • Ubuntu

Tags

angular 10 tutorial angular 11 ci tutorial codeigniter 4 image upload Codeigniter 4 Tutorial codeigniter tutorial CodeIgniter tutorial for beginners codeigniter with mysql crud operation eloquent relationships file upload File Validation form validation Image Upload jQuery Ajax Form Handling jquery tricks jquery tutorial laravel 6 Laravel 6 Eloquent Laravel 6 Model laravel 6 relationship laravel 6 relationship eloquent Laravel 6 Routing laravel 7 Laravel 7 Eloquent laravel 7 routing laravel 7 tutorial Laravel 8 laravel 8 example laravel 8 tutorial laravel 9 example laravel 9 tutorial Laravel Framework laravel from scratch Laravel Socialite laravel social login nodejs pagination payment gateway php with mysql react js tutorial rewrite rule send mail validation wysiwyg editor

Latest Posts

  • How to Convert Date and Time from one timezone to another in php
  • how to get current date and time in php
  • Drag and Drop Reorder Items with jQuery, PHP & MySQL
  • Laravel 9 Toastr Notifications Example Tutorial
  • Laravel 9 CRUD Operation Example Using Google Firebase
  • Laravel 9 CKeditor Image Upload With Example
  • Laravel 9 Summernote Image Upload With Example
  • Laravel 9 Stripe Payment Gateway Integrate Example
  • How To Send Email Using Mailtrap In Laravel 9
  • Laravel 9 Fullcalendar Ajax Example Tutorial

Tools

  • Compound Interest Calculator
  • Hex to RGB Color Converter
  • Pinterest Video Downloader
  • Age Calculator Online
  • Convert JSON to PHP Array Online
  • JavaScript Minifier
  • CSS Beautifier
  • CSS Minifier
  • JSON Beautifier
  • JSON Minifier

Copyright © 2018 - 2022,

All Rights Reserved Powered by XpertPhp.com