官术网_书友最值得收藏!

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!");
    }
}
主站蜘蛛池模板: 秭归县| 萝北县| 伊金霍洛旗| 修水县| 鸡泽县| 衡水市| 虞城县| 亳州市| 嘉善县| 平利县| 梨树县| 台东市| 萍乡市| 三亚市| 永泰县| 安新县| 新源县| 修水县| 会理县| 吉水县| 乌审旗| 许昌县| 芷江| 冀州市| 太仓市| 手游| 图木舒克市| 娱乐| 古丈县| 武乡县| 寻乌县| 诸城市| 且末县| 丹东市| 旌德县| 巴彦淖尔市| 萨嘎县| 怀柔区| 壶关县| 屏东市| 左权县|