1.0.3 • Published 6 years ago

angular-one-decorators v1.0.3

Weekly downloads
15
License
ISC
Repository
github
Last release
6 years ago

Typescript 2 Decorators for angular 1

Here you can find some useful decorators written in Typescript 2 for angular 1 project.

Goal of these decorators

To help you out with the new semantic of angular 2 components I wrote some simple decorators in Typescript

Examples

Below you will find useful examples of the different decorators

Service

export let moduleName = 'service.module'
@Service({
    module: moduleName, // name of the angular module where you would like to attach this service,
    serviceName: 'yourServiceName' // then name under which this service will be injected
})
export class YourNewService{
}

Component

export let moduleName = 'component.module';
@Component({
    selector: 'httml-selector', // the name of your html-element
    module: moduleName , //name of the angular module where you would like to attach this component ,
    template: require('./your.template.html') // the template you want to use
})
export class YourComponentController {}

Filter

expot let moduleName = 'filter.module'
export class YourFilterClass {
    @Filter({
        filterName: 'filter1',
        module: moduleName
    })
    public filter1() {
        return (input: any) => {
           // do something with the input
        };
    }
    @Filter({
        filterName: 'filter2',
        module: moduleName
    })
    public filter2() {
        return (input:any) => {
            console.log('vnKey', input);
        };
    }
}

Run

export let moduleName = 'run.module';
export class YourRunConfig {
    @Run({
        module: moduleName
    })
    public run1() {
        
    }
}

Config

export let moduleName = 'config.module';
export class YourRunConfig {
    @Config({
        module: moduleName
    })
    public config1() {
        
    }
}

Include in module

you can just take the exported module names into your angular.module and build it with webpack

1.0.3

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.7.0

6 years ago

0.6.0

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago

0.4.4

7 years ago

0.4.2

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.0

7 years ago