mistic100 / jQCloud

jQuery plugin for drawing neat word clouds that actually look like clouds
mistic100.github.io/jQCloud
MIT License
268 stars 106 forks source link

JqCloud Implementation in Angular2 #17

Closed vikkasranakis closed 8 years ago

vikkasranakis commented 8 years ago

I am trying to integrate the JQCloud in angular2. I am able to access jquery in my ts file but not able to access JQ Cloud in ts.

ngAfterViewInit(){ //here you will have code where component content is ready. var s = document.createElement("script"); s.type = "text/javascript"; s.src = "http://mistic100.github.io/jQCloud/dist/jqcloud2/dist/jqcloud.min.js"; jQuery("head").append(s);

    jQuery('#jqcloud').jQCloud(this.data,{
    width: 500,
    height: 350
    });

}

Please guide me

mistic100 commented 8 years ago

Why are you injecting jqcloud.min.js from your code ? This is NEVER done like this.

And it does not work because the load of the JS file is asynchronous, use $.getScript if you want to do that (and you MUST NOT).

Now sorry but this is not related to jQCloud.