1.1.0 • Published 7 years ago

ng-ts-helpers v1.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

Use Angular2 TypeScript decorators in Angular1!

Before:

class MyComponent{
    attribute:string;
    onSave:string;
    model:MyModel;
}

angular
    .module('myModule')
    .component('myComponent', {
        templateUrl: 'myComponent.html',
        controller: MyComponent,
        controllerAs: 'vm',
        bindings: {attribute: '<', onSave: '&'},
        require: {model: 'ngModel'}
    });

After:

@TSHelpers.Component({templateUrl: 'myComponent.html'})
class MyComponent{
    @TSHelpers.Input() attribute:string;
    @TSHelpers.Output() onSave:string;
    @TSHelpers.Require('^ngModel') model:MyModel;
}

angular
    .module('myModule')
    .component('myComponent', MyComponent);