Athinodoros Sgouromallis Athinodoros Sgouromallis - 1 month ago 19
TypeScript Question

Ionic 2 using third party js libs

Hi I am tring to use DrumJs in an ionic 2 project and this library requires to run $("select").drum() when the document is ready but even though i have it in a $(document).ready(function().....) it runs before the document :/ Any ideas where to add this in order to run properly?

p.s. I can not import it in my .ts file so i'm using gulp to concatinate some js files that I import via the index.html

Answer

Try to run your code using one of the lifecycle events, i.e.:

ionViewLoaded() {
    $("select").drum();
}

Here is the documentation:

http://ionicframework.com/docs/v2/api/components/nav/NavController/#lifecycle-events

Comments