Я использую Typescript с angular 1.5. У меня возникла проблема с передачей переменной компоненту привязки.
Вот соответствующий код - я удалил большую часть не относящегося к делу кода.
module xyz.dashboard {
class PatientPhaseCountController {
public static $inject = [];
public title: string;
public chartType: string;
///// /* @ngInject */
constructor() {
this.title = 'Patient Phase Count';
console.log(this.chartType);
this.$onInit();
}
public $onInit(): void {
console.log(this);
};
}
class PatientPhaseCount implements ng.IComponentOptions {
public bindings: any;
public controller: any;
public templateUrl: string;
constructor() {
this.bindings = {
chartType: '@'
};
this.controller = PatientPhaseCountController;
this.templateUrl = 'app/dashboard/patientPhaseCount/patientPhaseCount.component.html';
}
}
}
и вот фрагмент html:
chartType is always undefined. Any help is appreciated.