Socket
Socket
Sign inDemoInstall

@gund/ng-annotations

Package Overview
Dependencies
5
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @gund/ng-annotations

Extract metadata of Angular components, directives, service etc.


Version published
Maintainers
1
Install size
173 kB
Created

Readme

Source

ng-annotations

Extract metadata of Angular components, directives, service etc.

Travis CI Coverage Npm Npm Downloads semantic-release

Installation

$ npm install --save @gund/ng-annotations

Usage

Import Annotations class first:

import { Annotations } from 'ng-annotations';

Then get annotations for you component:

@Component({selector: 'some-component'})
class MyComponent {
  constructor() {
    const annotations = Annotations.getFor(MyComponent);
    // annotations.selector here will be `some-component`
  }
}

Documentation

Annotations

class Annotations {
  static getFor(type: Type<any>): AllDecorators;
  static getForDirective(type: Type<any>): Directive;
  static getForComponent(type: Type<any>): Component;
  static getForPipe(type: Type<any>): Pipe;
}

See src/annotations.ts for full reference

Description: Class with static methods to get annotations from type.

getFor()

static getFor(type: Type<any>): AllDecorators;

Description: Get annotations for the type. It will return all annotations found. If you want more specific type use methods below.

getForDirective()

static getForDirective(type: Type<any>): Directive;

Description: Get annotations for directive. Calls getFor() but returns type specific for Directive.

getForComponent()

static getForComponent(type: Type<any>): Component;

Description: Get annotations for component. Calls getFor() but returns type specific for Component.

getForPipe()

static getForPipe(type: Type<any>): Pipe;

Description: Get annotations for pipe. Calls getFor() but returns type specific for Pipe.

Development

To generate all *.js, *.js.map, *.d.ts and *.metadata.json files:

$ npm run build

To lint all *.ts files:

$ npm run lint

To run unit tests:

$ npm test

License

MIT © Alex Malkevich

Keywords

FAQs

Last updated on 14 Apr 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc