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

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)

主站蜘蛛池模板: 蓬溪县| 赤城县| 深州市| 巩义市| 昌黎县| 永安市| 绵竹市| 资溪县| 菏泽市| 文化| 柏乡县| 日土县| 郑州市| 江阴市| 彭泽县| 泰和县| 雷州市| 平阳县| 萨迦县| 英吉沙县| 武强县| 衡南县| 民丰县| 洪泽县| 广德县| 井研县| 遂昌县| 墨竹工卡县| 馆陶县| 二手房| 勐海县| 芒康县| 固安县| 九台市| 荔波县| 湘西| 漾濞| 昭苏县| 抚松县| 廊坊市| 宁德市|