0.0.6 • Published 1 year ago
custom-angular-time-picker v0.0.6
Angular Custom Time Picker
This library was generated with Angular CLI version 15.0.0.
Installation
- Install package from npm.
npm install custom-angular-time-picker --save
Usage
- Include CustomAngularTimePickerComponentModule into your application.
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { CustomAngularTimePickerComponentModule } from 'ng2-datepicker';
@NgModule({
imports: [BrowserModule, CustomAngularTimePickerComponentModule],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule {}
- And that's it, you can then use it in your component as ts file:
<form [formGroup]="addNewTime">
<custom-angular-time-picker
[value]="addNewTime.value.workSheduleTime"
(onChange)="handleOnTimeChange($event)" >
</custom-angular-time-picker>
</form>
- And that's it, you can then use it in your component as html file:
import { ControlContainer, FormBuilder, FormGroup, FormGroupDirective } from '@angular/forms';
@Component({
selector: 'ParentComponentName',
templateUrl: '',
styleUrls: [''],
viewProviders: [{
provide: ControlContainer,
useExisting: FormGroupDirective
}]
})
export class ParentComponentName implements OnInit {
addNewTime!: FormGroup;
constructor(private fb: FormBuilder){
}
initForm() {
this.addNewTime = this.fb.group({
'workSheduleTime': ['', Validators.required]
})
}
}
Run Demo
- Clone this repository.
git clone https://github.com/Nikunj1896/custom-angular-time-picker
- Install dependencies.
npm install
- Start the demo
ng serve