angular2 and zingchart Uncaught (in promise) in lable/node_click - charts

I am using zingchart in my angular2 application and came a cross this problem.
when I am trying to click the node - I get:
angular2.dev.js:23730 EXCEPTION: Error: Uncaught (in promise): TypeError: Cannot read property 'parentNode' of null
when I try to do that same when I am in debug mode - i.e. do it slower when jumping from line to line everything works fine.
I read a lot about about the Uncaught (in promise): TypeError: here and tried some solutions but with no luck.
Maybe anyone have an idea for me?
Thanks
I have a pie chart:
Which have the following code:
render(){
this.zone.runOutsideAngular(() => {
zingchart.render({
id : this.chart['id'],
data : this.chart['data'],
width : this.chart['width'],
height: this.chart['height']
});
zingchart.node_click = function(p) {
window.location.href = #/resources";
}
});}
my resource component is very simple:
import { Component } from 'angular2/core';
#Component({
selector: 'resources-component',
templateUrl: `I am the resource page`,
})
export class ResourcesComponent {
title: string = 'resources';
constructor() {
}
}

Related

I add to my ionic project camera plugin but i recieve an error: object is not a function

When I add the camera plugin and run my app i recieve the following error:
ERROR Error: Uncaught (in promise): TypeError: Object(...) is not a
function TypeError: Object(...) is not a function
at Camera.getPicture
app.module.ts add those
import { Camera, CameraOptions } from '#ionic-native/camera'; **Ionic 3**
import { Camera, CameraOptions } from '#ionic-native/camera/ngx'; **Ionic 4**
providers: [
Camera
]

allure.createAttachment exception error - Cannot read property 'currentStep' of undefined

I can successfully add screenshots to allure reports, but i get the following exception error:
error:
TypeError: Cannot read property 'currentStep' of undefined
at Allure.addAttachment (/Users//xxx/xxx/xxx/node_modules/allure-js-commons/index.js:86:45)
at Allure.createAttachment (/Users/xxx/xxx/xxx/node_modules/allure-js-commons/runtime.js:48:29)
at /Users/xxx/xxx/xxx/lib/class/class-name.js:30:20
at process._tickCallback (internal/process/next_tick.js:68:7)
class:
browser.takeScreenshot().then(function (png) {
allure.createAttachment(title, new Buffer(png, 'base64'));
}).catch((error: any) => console.log(error));
const allure = require('mocha-allure-reporter');
allure is a global identifier, injected by reporter to your code.
Add the following line to the top of your file to tell Typescript about it
declare const allure: any;
I think createAttachment requires a callback function and not a buffer being passed directly.
Can you try changing your code to reflect the following
browser.takeScreenshot().then(function (png) {
allure.createAttachment('Screenshot', function () {
return new Buffer(png, 'base64')
}, 'image/png')()
}).catch((error: any) => console.log(error));

ionic 3 move from login page to Tabspage gives error

i'm trying to make an app that has login page then after login the user must be insde tabs page, i get error
app.components.ts
import { LoginPage } from '../pages/login/login';
#Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage:any = LoginPage;
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
statusBar.styleDefault();
splashScreen.hide();
});
}
}
login.ts
signIn(){
this.navCtrl.push(TabsPage);
}
login.html
<button ion-button block (click)="signIn()">Sign In</button>
when i click sign in button i get the below error, please help
Runtime Error
Uncaught (in promise): invalid views to insert
Stack
Error: Uncaught (in promise): invalid views to insert
at c (http://localhost:8100/build/polyfills.js:3:19752)
at Object.reject (http://localhost:8100/build/polyfills.js:3:19174)
at NavControllerBase._fireError (http://localhost:8100/build/vendor.js:51705:16)
at NavControllerBase._failed (http://localhost:8100/build/vendor.js:51698:14)
at http://localhost:8100/build/vendor.js:51745:59
at t.invoke (http://localhost:8100/build/polyfills.js:3:14976)
at Object.onInvoke (http://localhost:8100/build/vendor.js:5134:33)
at t.invoke (http://localhost:8100/build/polyfills.js:3:14916)
at r.run (http://localhost:8100/build/polyfills.js:3:10143)
at http://localhost:8100/build/polyfills.js:3:20242
I finally found it write, i didn't not import TabsPage, after import it was working well

aws-amplify integration with Nativescript (angular)

I am trying to integrate ams-amplify with NativeScript but I am not able to get it to work successfully.
import { Component, OnInit } from "#angular/core";
require("nativescript-nodeify");
var Amplify = require("aws-amplify");
#Component({
selector: "Home",
moduleId: module.id,
templateUrl: "./home.component.html"
})
export class HomeComponent implements OnInit {
constructor() {
// Use the component constructor to inject providers.
Amplify.configure({
Auth: {
// REQUIRED - Amazon Cognito Identity Pool ID
identityPoolId: 'xxxxx',
// REQUIRED - Amazon Cognito Region
region: 'xxxx',
// OPTIONAL - Amazon Cognito User Pool ID
userPoolId: 'xxxx',
// OPTIONAL - Amazon Cognito Web Client ID
userPoolWebClientId: 'xxxxx',
}
});
}
ngOnInit(): void {
}
}
But I am getting some "navigator is not defined" error.
JS: ERROR Error: Uncaught (in promise): ReferenceError: navigator is
not defined JS: ReferenceError: navigator is not defined JS: at
standardBrowserEnv
(file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/lib/helpers/isURLSameOrigin.js:11:39)
JS: at Object.
(file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/lib/helpers/isURLSameOrigin.js:60:5)
JS: at require (:1:266) JS: at Object.
(file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/lib/adapters/xhr.js:7:23)
JS: at require (:1:266) JS: at getDefaultAdapter
(file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/lib/defaults.js:20:15)
JS: at Object.
(file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/lib/defaults.js:29:12)
JS: at require (:1:266) JS: at Object.
(file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/lib/core/Axios.js:3:16)
JS: at require (:1:266) JS: at Object.
(file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/lib/axios.js:5:13)
JS: at require (:1:266) JS: at Object.
(file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/index.js:1:78)
JS: at require (:1:266) JS: at Object.
(file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/aws-amplify/lib/API/RestClient.js:70:15)
If anyone has working code, please share.
The problem is with latest version of aws-amplify.
Changed it to "aws-amplify": "^0.2.9" version and everything working fine now :)
Edit: Working Solution with latest Amplify version
import * as storage from "nativescript-localstorage";
import { Buffer } from "buffer";
import "nativescript-nodeify";
global["window"] = {};
global["window"]["localStorage"] = storage;
global["window"]["addEventListener"] = args => {
return args;
};
global["window"]["navigator"] = {};
global["window"]["Buffer"] = Buffer;
global["window"]["setTimeout"] = setTimeout;
global["window"]["clearTimeout"] = clearTimeout;
global["navigator"] = {};
global["navigator"]["product"] = "ReactNative";
import Amplify, { Auth, Storage } from "aws-amplify";
import aws_config from "~/aws-exports";
Amplify.configure(aws_config);

Error when using System.paths['jquery'] = './node_modules/jquery/dist/jquery.js'

I was using traceur and es6 loader, but I change to systemjs and when I try to use System.paths['jquery'], I had the message:
Error: Cannot set SystemJS.paths["jquery"] directly. Use SystemJS.config({ paths: { "jquery": ... } }) rather
So I change to:
System.config({
paths: {
"jquery": "./node_modules/jquery/dist/jquery.js"
}
});
System.import('jquery');
System.import('src/app.js');
Show this error:
system.js:4 Uncaught (in promise) Error: Fetch error: 404 Not Found
system.js:4 Uncaught (in promise) Error: Unable to dynamically transpile ES module
A loader plugin needs to be configured via `SystemJS.config({ transpiler: 'transpiler-module' })`.
I tried, but didn't work:
System.config({
transpiler: "babel",
map: {
"babel": "./node_modules/babel-core/lib/api/browser.js",
"jquery": "./node_modules/jquery/dist/jquery.js"
}
})
Error
system.js:4 Uncaught (in promise) Error: Fetch error: 404 Not Found
Instantiating localhost:3000/node_modules/babel-core/lib/api/node
Loading localhost:3000/node_modules/babel-core/lib/api/browser.js
Loading babel
Unable to load transpiler to transpile localhost:3000/src/app.js
I think you need to inform systemjs that jquery should be added as a global script so it doesn't try to transpile it. Try the following:
System.config({
paths: {
"jquery": "./node_modules/jquery/dist/jquery.js"
},
meta: {
"jquery": { "format": "global" }
}
});