angular-typescript
angular-typescript copied to clipboard
I've modified this repository
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();
}
…
Hi great idea!
But I see 2 issues (1st one is production issue, 2nd it's just my own, opinionated 'but'):
- Will not work for minified code
- I don't like union types (
string | angular.IModule). I prefer totally strict typing.
Thank you for your recommendation
- 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.
- I look that like another overload function I prefer to look a module like a class or an object rather than a string
- I'll probably update it with your idea - maybe you can create pull request with "service name omission" only :)
- I'm thinking of better way - omit
module/module nametotally (https://github.com/ulfryk/angular-typescript/issues/3), so you get:
@service('myService')
class MyService { … }
Thx for advices and ideas ;)