Flexmonster MCP Server is here! Connect your ✨AI assistant to our documentation. Get started
+

Create a wrapper in angular4

Answered
juanciga Juan Martin Ciga asked on May 17, 2017

 I am trying to create a wrapper in angular 4 to load the javascript files. Everything seems to work until the files jquery-ui and jqueryhelpers raise the error Uncaught ReferenceError: jQuery is not defined at jqueryui.min.js:5. My code looks like this
import { Directive, Component, ElementRef, Input, Output, EventEmitter } from "@angular/core";
import 'jquery';
declare let jQuery: any;

@Directive ({
selector: '[pivot-table]'
})
export class PivotTable {
$el: any;
constructor(el: ElementRef) {
this.$el = jQuery(el.nativeElement);
}
render(): void {
let jsonData = [
{
"Color" : "green",
"Country" : "Canada",
"State" : "Ontario",
"City" : "Toronto",
"Price" : 174,
"Quantity" : 22
},
{
"Color" : "red",
"Country" : "USA",
"State" : "California",
"City" : "Los Angeles",
"Price" : 166,
"Quantity" : 19
}
];
let pivot = $("#pivotContainer").flexmonster({
toolbar: true,
componentFolder:'assets/flexmonster/',
report: {
dataSource: {
data: jsonData
},
slice: {
rows: [
{ uniqueName: "Color" },
{ uniqueName: "[Measures]" }
],
columns: [
{ uniqueName: "Country" }
],
measures: [
{
uniqueName: "Price",
aggregation: "sum"
}
]
}
},
licenseKey: ""
});
}
ngAfterViewInit(): void {
this.render();
}
}

3 answers

Public
Roman Petrusha Roman Petrusha ⋅ Flexmonster ⋅ May 18, 2017

Hi Juan Martin,
I'm already aware of your problem.
We can make research and prepare a demo especially for you to the next minor 2.317 (ETA June 5th).

Regards,
  Roman

Public
juanciga Juan Martin Ciga ⋅ May 18, 2017

Thank you that would be great!!!

Public
Dmytro Zvazhii Dmytro Zvazhii ⋅ Flexmonster ⋅ June 6, 2017

Hello Juan Martin,
We glad to inform you that the integration with Angular4 sample is ready. Please visit our documentation page - http://www.flexmonster.com/doc/integration-with-angular/ . 
Let us know if everything works fine for you.
Best regards,
Dmytro.

Please sign in or register to submit your answer