Coder Social home page Coder Social logo

anouarghali / ngx-rrule Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kumar-muthu/ngx-rrule

0.0 1.0 0.0 1.22 MB

Angular form UI control for Rrule js

Home Page: https://kumar-muthu.github.io/ngx-rrule/

License: MIT License

JavaScript 3.72% HTML 29.11% TypeScript 66.76% CSS 0.22% SCSS 0.19%

ngx-rrule's Introduction

NgxRrule

Recurrence rules generator form control for Angular

Inspired and partially forked from https://github.com/Fafruch/react-rrule-generator

Alpha npm version LICENSE

Description

This is Angular form control using Bootstrap styling. It's built with the help of a great rrule.js library.

It also uses:

Demo

https://kumar-muthu.github.io/ngx-rrule/

Installation and Docs

Install

 $ npm i ngx-rrule @ng-bootstrap/ng-bootstrap rrule bootstrap

Import NgxRruleModule in your app:

import {NgxRruleModule} from 'ngx-rrule';

@NgModule({
    imports: [NgxRruleModule]
})
export class AppModule {}

style.scss

Optionally, this can be added to styles section of angular.json

@import '~bootstrap/dist/css/bootstrap.css';

app.component.html

<form [formGroup]="myform">
  <ngx-rrule formControlName="testRule"
             [hideStart]="false"
             [hideEnd]="false"
             tz="America/New_York"
             [frequency]="['Daily','Monthly','Weekly', 'Yearly']"></ngx-rrule>
</form>

app.component.ts

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

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
  myform: FormGroup;
  constructor(private formBuilder: FormBuilder) { }
  
  ngOnInit() {
    this.myform = this.formBuilder.group({
      testRule: ''
    });

    this.myform.valueChanges.subscribe(() => {
      const rRuleFormValue = this.myform.value.testRule;
      
      // Get the rrule object.
      // This is an instance of RRule. Refer to https://github.com/jakubroztocil/rrule on how to use it
      console.log(rRuleFormValue.rRule);
      
      // Optional - Raw value of the ngxRrule used internally
      console.log(rRuleFormValue.raw);
    });
  }
}

Options

Option Description
hideStart

(optional) Hides the start date part in the form.Defaults to false

hideEnd

(optional) Hides the until(end) date part in the form.Defaults to false

frequency

(required) One or many of the following recurrence options

  • Daily
  • Weekly
  • Monthly
  • Yearly
tz

(optional) Timezone. Defaults to local timezone

License

MIT

ngx-rrule's People

Contributors

kumar-muthu avatar zainniazi avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.