S3 스토리지에 이미지를 업로드 할 때 Meteor-Angular2 및 slingshot 패키지를 사용하고 있습니다. 함수에서 리턴하고 바인드 된 문자열에 지정할 때 갱신되지 않은보기. (setTimout 기능이 작동하고 뷰를 갱신하지만 올린 기능 없음)콜백 함수 후에 Angular2 뷰가 업데이트되지 않았습니다.
export class AdminComponent {
public urlVariable: string = "ynet.co.il";
constructor() {
this.uploader = new Slingshot.Upload("myFileUploads");
setTimeout(() => {
this.urlVariable = "View is updated";
}, 10000);
}
onFileDrop(file: File): void {
console.log('Got file2');
this.uploader.send(file, function (error, downloadUrl) {
if (error) {
// Log service detailed response
}
else {
this.urlVariable = "View not updated";
}
});
}
}
라우터의 다른 경로로 이동하거나 페이지를 새로 고치는 작업을 수행하지 않으면보기가 업데이트되지 않습니다. – roish
어디에서'onFileDrop'이 호출되고 있습니까? –
감사합니다! 답 및 this._ngZone.run (() => {this.urlVariable = "보기가 업데이트되지 않음";}); 지금 바로 작업 중이며 즉시 업데이트 중입니다! :-) – roish