0.2.1 • Published 6 years ago

angular-required-decorator v0.2.1

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

Angular @Required() Decorator

A helpful decorator which logs a console error if a required property is missing.

Installation

npm install angular-required-decorator --save

Usage

  import { Component, Input } from '@angular/core';
  import Required from 'angular-required-decorator';

  @Component({
    selector: 'test-cmp',
    template: '<h1>{{title}}</h1>'
  })
  export class TestComponent {

    @Input() @Required() title: string;

  }

The Required() decorator optionally accepts a custom message.