-
-
Save learningjs/11475d41c416b167b8f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// AtScript | |
import {Component} from 'angular'; | |
import {Server} from './server'; | |
@Component({selector: 'foo'}) | |
export class MyComponent { | |
constructor(server:Server) { | |
this.server = server; | |
} | |
} | |
// ES6 | |
import * as rtts from 'rtts'; | |
import {Component} from 'angular'; | |
import {Server} from './server'; | |
export class MyComponent { | |
constructor(server) { | |
rtts.types(server, Server); | |
this.server = server; | |
} | |
} | |
// new Dependency Injection!!! | |
MyComponent.parameters = [{is:Server}]; | |
MyComponent.annotate = [ | |
new Component({selector: 'foo'}) | |
]; | |
// Annotations | |
// transpiled ES5 | |
MyComponent.annotate = [new Inject(Server)]; | |
// Control of instance reuse | |
// Singleton (same class for each injecion) | |
export class FooClass {} | |
// Create new class for each injection | |
@TransientScope | |
export class FooClass {} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment