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

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!");
    }
}
主站蜘蛛池模板: 云南省| 上高县| 塔河县| 荣昌县| 蒙山县| 洞头县| 金川县| 资溪县| 慈溪市| 林甸县| 安康市| 普陀区| 嘉定区| 临潭县| 巩义市| 文登市| 和田市| 葵青区| 开平市| 读书| 百色市| 西贡区| 吉林市| 广南县| 辽源市| 抚州市| 鄂州市| 文山县| 清苑县| 招远市| 嘉兴市| 吴堡县| 大关县| 尼勒克县| 金溪县| 涿鹿县| 德江县| 台安县| 汶川县| 惠水县| 吴堡县|