1.0.0 • Published 6 years ago

ng-jalali-calendar v1.0.0

Weekly downloads
6
License
MIT
Repository
github
Last release
6 years ago

Table of contents

Installation

npm install --save ng-jalali-calendar

Usage

Import NgJalaliCalendarModule in your module

import { NgModule } from '@angular/core';
import { NgJalaliCalendarModule } from 'ng-jalali-calendar'

@NgModule({
  imports: [ NgJalaliCalendarModule ]
})
export class YourModule { }

afterward, add the ng-jalali-component tag into the component where you want to use the calendar :

    <ng-jalali-calendar></ng-jalali-calendar>

API

Inputs:

InputTypeDescription
selectedDatesString[]dates that you want to be selected on the calendar

Events:

Output$eventDescription
dateSelectedStringemitted when selecting a date

the module works with dates in YYYY/MM/DD format

Example

import { Component, OnInit } from '@angular/core';  

@Component({
selector : 'app-example',
templateUrl: './example.component.html',
styleUrls : './example.component.css'
})
export class ExampleComponent implements OnInit {
selectedDate: string = '';
selectedDates: string[] = '1397/5/22', '1397/12/1' '1397/01/5' ;

constructor () {}  

ngOnInit () {
}
  
onSelectDate(event: string) { 
	this.selectedDate = event;  
}  

}

```html
<ng-jalali-calendar 
	(dateSelected)="onSelectDate($event)" 
	[selectedDates]="selectedDates"></ng-jalali-calendar>