上QQ阅读APP看书,第一时间看更新
Dependency injection
The dependency injection framework requires more configuration. In contrast to Aurelia, Angular requires you to specify the HTML selector and template, increasing the file complexity. Aurelia will detect the template based on a name strategy:
@Injectable() class Ticket { /* */ } @Component({ selector: 'ticket', providers: [Ticket], template: `...` }) //Configuration code mixed with business class export class Sale { constructor(private ticket: Ticket) {} public activate() { // do something... this.ticket.toast("Sale processed!"); } }