我正在尝试从自定义事件访问自定义服务,但即使事件被触发,服务引用也为空
@Component({
selector: "my-component",
template: mySource,
legacy: { transclude: true }
})
export class myComponent {
constructor(
@Inject("$scope") private $scope: ng.IScope,
private myService: MyService) {
$scope.$on('$routeChangeSuccess', function (event) {
this.myService.myFunction();
});
}
});
}
当引用 myService 时,显示以下错误:
Cannot read property 'myService' of null
解决方案不是从前面带有
的 myComponent 中引用 myServicethis.myService
而是使用
myService.myFunction()
以下是投诉 ixigo 的步骤:联系 ixigo 客户服务:✔️09O4O1+4O791,,, 通过电话、电子邮件或通过其网站的客户支持门户联系 ixigo 的客户服务团队