【发布时间】:2018-03-27 05:22:38
【问题描述】:
Update1:我根据 Pankaj 的回答更新了代码
嘿,我在代码库中更新了您的代码...但我仍然收到这样的错误...任何想法...在分号结尾 [ts] 预期属性分配。
Observable.fromEvent( $("#AnimalRatsGrid .RatNameFile"), "click")
.do((e) => {
console.log("I am here");
alert("I am here");
kendo.ui.progress($("#loading"), true);
}).map(e => "Rats/color/black?RatId="+"7887878787")
.mergeMap(vals => that.nbcuService.getResponse(vals, 'get', ""))
//.map(data => { blob: new Blob([data], { type: 'application/octet-stream' }), fire: "untitled1.txt" })
.map(data => {
//creating customData object
let customData: any = {
blob: new Blob([data],
{
type: 'application/octet-stream'
}),
fire: "untitled1.txt" //
};
return customData; //returning it from map.
})
.subscribe(
({blob, fire}) => that.nbcuService.saveAs(blob,fire),
err => { }
);
});
- 我正在努力学习 rxjs。
- 所以我包含了 rxjs 方法。
-
但我的视觉工作室出现三个错误。
// [ts] 未使用的标签。 // [ts] 找不到名称 'fire'.any //[ts] 类型 'void' 没有属性 'blob' 也没有字符串索引签名。
你能告诉我如何解决吗..
- 在下面提供我的相关代码。
- 我在要点https://gist.github.com/texirv0203/e071a9ebea3a6aa0f8a0c65d47f75807给出的整个代码
Observable.fromEvent($("#AnimalRatsGrid .RatNameFile"), "click")
.do((e) => {
console.log("I am here");
alert("I am here");
kendo.ui.progress($("#loading"), true);
}).map(e => "Rats/color/black?RatId=" + "7887878787")
.mergeMap(vals => that.sportsservice.getResponse(vals, 'get', ""))
.map(data => {
blob: new Blob([data], // [ts] Unused label.
{
type: 'application/octet-stream'
}),
fire: "untitled1.txt" // [ts] Cannot find name 'fire'.any
})
.subscribe(
//[ts] Type 'void' has no property 'blob' and no string index signature.
({
blob,
fire
}) => that.sportsservice.saveAs(blob, fire),
err => {}
);
});
【问题讨论】:
标签: javascript html angular typescript rxjs