KiteConnect is not a constructor
vijaysahu12 opened this issue · 1 comments
vijaysahu12 commented
While using the below code in Angular 9
var jsonDataToken = jsonData.filter(item => item.accessToken !== '')[0];
var KiteConnect = require("kiteconnectts").KiteConnect;
var kc = new KiteConnect({api_key: jsonDataToken.apiKey});
kc.generateSession(jsonDataToken.accessToken, jsonDataToken.secretKey)
.then(function(response) {
init();
})
.catch(function(err) {
console.log(err);
})
function init() {
// Fetch equity margins.
// You can have other api calls here.
kc.getMargins()
.then(function(response) {
// You got user's margin details.
}).catch(function(err) {
// Something went wrong.
});
}
Mondal10 commented
There is a typo on the 2nd line in your shared code snippet:
// Check the spelling of 'kiteconnectts'
var KiteConnect = require("kiteconnectts").KiteConnect;
// Correct one
var KiteConnect = require("kiteconnect").KiteConnect;