i have qz-tray.js on ionic, it is worked BUT after the successful print the app crashed when i want to navigate to other page, here is the logs
ionic.bundle.min.js:142 TypeError: Cannot read property 'params' of undefined
at i (ionic.bundle.min.js:423)
at Object.x.transitionTo (ionic.bundle.min.js:423)
at Array.<anonymous> (ionic.bundle.min.js:423)
at Object.e [as invoke] (ionic.bundle.min.js:73)
at g (ionic.bundle.min.js:423)
at ionic.bundle.min.js:423
at b (ionic.bundle.min.js:423)
at m (ionic.bundle.min.js:423)
at n.$broadcast (ionic.bundle.min.js:171)
at l (ionic.bundle.min.js:138)
i just put qz-tray.js
as depedency and then on the controller
qz.websocket.connect().then(function () {
return qz.printers.find('MobilePrinter');
}).then(function (printer) {
var config = qz.configs.create(printer);
var data = [respon.data];
return qz.print(config, data).then(function () {
qz.websocket.disconnect();
});
})
it did print the data but after that the app crashed, any help would be appreciated, thanks.
[SOLVED]
this function affect array iteration (for in), i comment the prototype solved the problem (qz-tray.js
line 500)
stringify: function(object) {
//old versions of prototype affect stringify
var pjson = Array.prototype.toJSON;
delete Array.prototype.toJSON;
var result = JSON.stringify(object);
Array.prototype.toJSON = pjson;
return result;
},