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 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-annotations

v1.1.6

Published

AngularJS 1.x ES7 decorators

Downloads

23

Readme

angular-annotations Build Status

AngularJS 1.x ES7 decorators

Get Started

  • NPM npm install -S angular-annotations
  • JSPM jspm install npm:angular-annotations

Available Decorators

Module

import {Module} from 'angular-annotations';

@Module('someAngularModuleName')
class MyClass {
}

Inject

import {Inject, Module} from 'angular-annotations';

@Inject('$someService')
@Module('someAngularModuleName')
class MyClass {
    @Inject('$http')
    static someStaticMethod($http) {}
}
// will add
MyClass.$inject = ['$someService'];
MyClass.someStaticMethod.$inject = ['$http'];

InjectAsProperty

import {Service, InjectAsProperty, Module} from 'angular-annotations';

@InjectAsProperty('$http', '$q')
@Service('someService')
@Module('someAngularModuleName')
class MyClass {
    $http;
    $q;
}

Config

import {Inject, Module, Config} from 'angular-annotations';

@Config
@Module('someAngularModuleName')
@Inject('$someProvider')
class MyConfig {
    constructor($someProvider) {}
}
// is equal to
angular
    .module('someAngularModuleName')
    .config(['$someProvider', $someProvider => new MyConfig($someProvider)]);

Constant

import {Module, Constant} from 'angular-annotations';

@Constant('SOME_CONSTANT')
@Module('someAngularModuleName')
class MyConstant {
    constant1 = 'constant1';
}
// is equal to
angular
    .module('someAngularModuleName')
    .constant('SOME_CONSTANT', new MyConstant());

Controller

import {Inject, Module, Controller} from 'angular-annotations';

@Controller
@Module('someAngularModuleName')
@Inject('$rootScope')
class MyController {
    constructor($rootScope) {}
}
// is equal to
angular
    .module('someAngularModuleName')
    .controller('MyController', ['$rootScope', MyController]);

Decorator

import {Inject, Module, Decorator} from 'angular-annotations';

@Decorator('$someService')
@Module('someAngularModuleName')
@Inject('$delegate')
class MyDecorator {
    constructor($delegate) {}
}
// is equal to
angular
    .module('someAngularModuleName')
    .decorator('$someService', ['$delegate', $delegate => new MyDecorator($delegate)]);

Directive

import {Inject, Module, Directive} from 'angular-annotations';

@Directive('some-selector')
@Module('someAngularModuleName')
class MyDirective {
    restrict = 'EA';
    controllerAs = 'vm';
    scope = {};
    
    link() {}
    
    @Inject('someService')
    controller(someService) {}
}
// is equal to
angular
    .module('someAngularModuleName')
    .directive('someSelector', new MyDirective());

Component

import {Inject, Module, Component} from 'angular-annotations';

@Component('some-selector')
@Module('someAngularModuleName')
class MyComponent {
    restrict = 'EA';
    controllerAs = 'vm';
    scope = {};

    link() {}

    @Inject('someService')
    controller(someService) {}
}
// is equal to
angular
    .module('someAngularModuleName')
    .component('someSelector', new MyComponent());

Factory

import {Inject, Module, Factory} from 'angular-annotations';

@Factory('someFactory')
@Module('someAngularModuleName')
@Inject('$http')
class MyFactory {
    constructor($http) {}
}
//is equal to
angular
    .module('someAngularModuleName')
    .factory('someFactory', ['$http', $http => new MyFactory($http)]);

Filter

import {Inject, Module, Filter} from 'angular-annotations';

@Filter('someFilter')
@Module('someAngularModuleName')
@Inject('someFactory')
class MyFilter {
    constructor($http) {}
}
// is equal to
angular
    .module('someAngularModuleName')
    .filter('someFilter', ['someFactory', someFactory => new MyFilter(someFactory)]);

Provider

import {Inject, Module, Provider} from 'angular-annotations';

@Provider('someService')
@Module('someAngularModuleName')
@Inject('$http')
class MyProvider {
    constructor($http) {}
}
// is equal to
angular
    .module('someAngularModuleName')
    .provider('someService', ['$http', MyProvider]);

Run

import {Inject, Module, Run} from 'angular-annotations';

@Run
@Module('someAngularModuleName')
@Inject('someService')
class MyRun {
    constructor(someService) {}
}
// is equal to
angular
    .module('someAngularModuleName')
    .run(['someService', someService => new MyRun(someService)]);

Service

import {Inject, Module, Service} from 'angular-annotations';

@Service('someService')
@Module('someAngularModuleName')
@Inject('$http')
class MyService {
    constructor($http) {}
}
// is equal to
angular
    .module('someAngularModuleName')
    .service('someService', ['$http', MyService]);

Value

import {Module, Value} from 'angular-annotations';

@Value('someValue')
@Module('someAngularModuleName')
class MyValue {
    value1 = 'a';
}
// is equal to
angular
    .module('someAngularModuleName')
    .value('someValue', new MyValue());