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

Dependency injection

All you need is the @autoinject annotation. The JS/HTML mapping is performed automatically by the framework:

class Ticket { /* class code, properties, methods... */ }

@inject
export class Sale {
constructor( ticket ) {} public activate() { // do something... this.ticket.toast("Sale processed!"); } }

For Typescript users, the annotation names are very similar. Use @autoinject instead of @inject and don't forget to specify the visibility and type of object in the constructor : constructor(private ticket : Ticket)

主站蜘蛛池模板: 泾阳县| 江西省| 张家港市| 喜德县| 宁化县| 阳朔县| 邹城市| 泽普县| 百色市| 汝阳县| 潮州市| 泸定县| 乐都县| 岗巴县| 屯昌县| 潜江市| 禄丰县| 基隆市| 论坛| 翁牛特旗| 龙口市| 秀山| 印江| 鹤壁市| 当涂县| 增城市| 富川| 习水县| 靖安县| 鄢陵县| 五指山市| 务川| 玉林市| 耒阳市| 宁蒗| 上蔡县| 金坛市| 南漳县| 海南省| 石景山区| 景德镇市|