angular-typescript icon indicating copy to clipboard operation
angular-typescript copied to clipboard

I've modified this repository

Open thakerng opened this issue 10 years ago • 3 comments

https://github.com/nodeframe/angular-typescript

Modify to be

@at.service(module:string|angular.IModule, serviceName?: string)
@at.inject(dependencyOne: string, ...dependencies?: string[])
@at.controller(module: string|angular.IModule, controllerName?: string)
@at.directive(module: string|angular.IModule, directiveName?: string)
@at.classFactory(module: string|angular.IModule, className?: string)
@at.resource(module: string|angular.IModule, resourceClassName?: string)

if name is undefined, that use class name instead

example


@service('test')
class TestService {
  .....
}

and the somewhere else

    …
    constructor(
        @inject('testService') TestService: TestService
    ) {
        this.testService = new TestService();
    }
    …

thakerng avatar Sep 23 '15 17:09 thakerng

Hi great idea!

But I see 2 issues (1st one is production issue, 2nd it's just my own, opinionated 'but'):

  1. Will not work for minified code
  2. I don't like union types ( string | angular.IModule ). I prefer totally strict typing.

ulfryk avatar Sep 24 '15 13:09 ulfryk

Thank you for your recommendation

  1. It's fine even through minification is a limitation, But that's just an option I got the idea from extracting the dependencies in Angular that has the same limitation as well.
  2. I look that like another overload function I prefer to look a module like a class or an object rather than a string

thakerng avatar Sep 26 '15 14:09 thakerng

  1. I'll probably update it with your idea - maybe you can create pull request with "service name omission" only :)
  2. I'm thinking of better way - omit module/module name totally (https://github.com/ulfryk/angular-typescript/issues/3), so you get:
@service('myService')
class MyService { … }


Thx for advices and ideas ;)



ulfryk avatar Sep 26 '15 20:09 ulfryk