npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ng1-decorators

v3.1.2

Published

This is a small angular decorator collection to easily separate your code from angular. On the given class creates a static factory method for angular. It gets the dependencies from the constructor and provide it to the angular injector.

Readme

#Angular 1 Decorators

This is a small angular decorator collection to easily separate your code from angular. On the given class creates a static factory method for angular. It gets the dependencies from the constructor and provide it to the angular injector.

npm install --save ng1-decorators

Setup

Add Babel stage-1 to your babelrc as preset

Filters

A Filter (Pipe) class should have a transform function!

###Class

const Pipe = require('ng1-decorators').Pipe;

@Pipe
class CustomPipe {
    constructor(dep1, dep2) {
        this._dep1 = dep1;
        this._dep2 = dep2;
        this.transform = this.transform.bind(this;
    }

    transform(input) {
        return this._input + this._dep1 + this._dep2;
    }

}

###Angular module

angular
    .module('test', [])
    .filter('customer', CustomPipe.create());

###Created Factory Method

CustomPipe.create = () => {
    return ['dep1', 'dep2', (dep1, dep2) => {
      return (new Pipe(dep1, dep2)).transform;
    }];
};

##Services

###Class

const Service = require('ng1-decorators').Service;

@Service
class CustomService {
    constructor(dep1) {
        this._dep1 = dep1;
    }

    method() {
        return this._dep1 + 'yo!';
    }

}

###Angular module

angular
    .module('test', [])
    .service('custom', CustomService.create());

###Created Factory Method

CustomService.create = () => {
    return ['dep1', 'dep2', CustomService];
};

##Directives

###Class

const Directive = require('ng1-decorators').Directive;

@Directive({
    template: '<div>hello</div>',
    scope: {
        input1: '@',
        input2: '@'
    },
    link: (element, scope, attributes, ctrl) => {
        ctrl.addElement(element);
    }
}
})
class CustomDirective {
    constructor(dep1) {
        this._dep1 = dep1;
        this._element = null;
    }

    addElement(element) {
        this._element = element;
    }

    method() {
        return this._dep1 + 'yo!';
    }

}

###Defaults

{
  restrict: 'E',
  replace: false,
  bindToController: true,
  controllerAs: 'ctrl'
}

###Angular module

angular
    .module('test', [])
    .directive('custom', CustomDirective.create());

###Created Factory Method

CustomDirective.create = () => {
    return () => ({
        restrict: 'E',
        replace: false,
        bindToController: true,
        controllerAs: 'ctrl',
        controller: ['dep1', CustomDirective], 
        template: '<div>hello</div>',
        scope: {
            input1: '@',
            input2: '@'
        },
        link: (element, scope, attributes, ctrl) => {
            ctrl.addElement(element);
        });
    };
};