smallcalendar v0.0.4
Smallcalendar
This library was generated with Angular CLI version 9.1.11.
Code scaffolding
Run ng generate component component-name --project smallcalendar
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module --project smallcalendar
.
Note: Don't forget to add
--project smallcalendar
or else it will be added to the default project in yourangular.json
file.
Installation
Install smallcalendar from npm:
Run
npm install smallcalendar --save
Add needed package to NgModule imports:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import {SmallcalendarModule} from 'smallcalendar'
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,SmallcalendarModule,
AppRoutingModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Add component to your page:
<smallcalendar [(setdate)]="setdate" [selectedDates]="selected_dates" [Options]="dateoptions" (onSelect)="onSelectdate($event);"></smallcalendar>
Event Handling
onSelectdate(event)
{
if (event.type == 'small-calendar.month-changed')
{
this.setdate=event.value.toDate()
}
if (event.type == 'small-calendar.day-selected')
{
this.setdate=event.value.toDate()this.fromdate = event.value.toDate();
}
if (event.type == 'small-calendar.multiday-selected')
{
thisetdate = new Date(event.value[0]);}
}
Build
Run ng build smallcalendar
to build the project. The build artifacts will be stored in the dist/
directory.
Publishing
After building your library with ng build smallcalendar
, go to the dist folder cd dist/smallcalendar
and run npm publish
.
Running unit tests
Run ng test smallcalendar
to execute the unit tests via Karma.
Further help
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.