Property 'callproducts' does not exist on type 'XMLHttpRequest'

Property 'callproducts' does not exist on type 'XMLHttpRequest'



Description: I used XMLHttpRequest in my project. I want to call another function when i get status.Below is my home.ts code.


home.ts



onFileSelected(event) is called when file is selected from input type, everything works fine except when i try to call this function
this.callproducts(data,0,c_altcode)


onFileSelected(event)


this.callproducts(data,0,c_altcode)



Please guide me how can i call this function



home.ts


home.ts


onFileSelected(event)

var file = event.target.files[0];
var url = window.URL.createObjectURL(file);
var oReq = new XMLHttpRequest();
oReq.open("GET", url, true);
oReq.responseType = "arraybuffer";

oReq.onload = function(e)
var arraybuffer = oReq.response;


var data = new Uint8Array(arraybuffer);

var arr = new Array();
for (var i = 0; i != data.length; ++i) arr[i] = String.fromCharCode(data[i]);
var bstr = arr.join("");


var workbook = XLSX.read(bstr,
type: "binary"
);


var first_sheet_name = workbook.SheetNames[0];


var worksheet = workbook.Sheets[first_sheet_name];


var final_arr = XLSX.utils.sheet_to_json(worksheet,
raw: true
);


if(oReq.status === 200)

if(final_arr[0].hasOwnProperty("Altcode"))

var c_altcode =final_arr[0].hasOwnProperty("Altcode");
// error comming in this line.
this.callproducts(data,0,c_altcode);





oReq.send(null);



// This is my `callproducts()` which i want to call.
callproducts(data,index,srch)

// some code here



Error: Property 'callproducts' does not exist on type 'XMLHttpRequest'.






Well, where does callproducts exist?

– nitind
Sep 13 '18 at 7:16


callproducts






I edit my question. Please read.

– Kirandeep Kaur
Sep 13 '18 at 7:22






Maybe a stupid question, but why do you use XMLHttpRequest instead of HttpClient? The second is easier to use and test in Angular apps.

– Mac_W
Sep 13 '18 at 7:25






what is the way to call this function from inside another function ?

– user2828442
Sep 13 '18 at 8:12




0



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)