ERROR TypeError: window.Flexmonster is not a function

I am trying to use angular wrapper of Flex monster and downloaded pivot-angularjs4-master.zip from github. Downloaded version works fine and I can see pivot.
As per instructions in “integration-with-angular-4” guide, I –

  • Downloaded Flex Monster component and copied “flexmonster” folder to my project.
  • Modified app.component.ts for [componentFolder] and pointed it to “flexmonster” folder
  • Modified index.html and commented Flexmonster section.

I am getting exception in browser console “ERROR TypeError: window.Flexmonster is not a function”.
Please let me know if I am making in mistake in integration.

<!-- app.component.ts (downloaded) -->
<fm-pivot [componentFolder]="'https://cdn.flexmonster.com/'"
[toolbar]="true"
[width]="'50%'"
[height]="300"
[report]="{
dataSource: {
data: jsonData
}
}"
[customizeCell]="onCustomizeCell"
(ready)="onPivotReady($event)">
Flexmonster will appear here
</fm-pivot>

<!-- app.component.ts (Modified) -->
<fm-pivot [componentFolder]="'flexmonster'"
[toolbar]="true"
[width]="'50%'"
[height]="300"
[report]="{
dataSource: {
data: jsonData
}
}"
[customizeCell]="onCustomizeCell"
(ready)="onPivotReady($event)">
Flexmonster will appear here
</fm-pivot>

<!-- Commented below two script lines in index.html -->
<!-- Flexmonster -->
<!-- <script src="https://code.jquery.com/jquery-2.2.4.min.js"></script> -->
<!-- <script src="https://cdn.flexmonster.com/flexmonster.js"></script> -->

<!-- Exception in browser console -->
app.component.html:1 ERROR TypeError: window.Flexmonster is not a function
at FlexmonsterPivot.ngOnInit (flexmonster.angular4.ts:60)
at checkAndUpdateDirectiveInline (provider.ts:275)

 
 
 
 
 
 
 
 

1 answer

Public
Dmytro Zvazhii Flexmonster February 12, 2018

Hello Nikhil,
Thank you for your question. This error means that Flexmonster library is not included into the project. Angular 4 project example gets the necessary Flexmonster files remotely from CDN. Please check our integration with webpack example – https://www.flexmonster.com/doc/integration-with-webpack/. It should help you to import all the necessary Flexmonster files from the local environment.
Please let us know if everything works fine for you.
Regards,
Dmytro.

Please login or Register to Submit Answer