Angular 19 + jquery integration

Discussão em 'Angular' iniciado por Stefano Giammori, Março 8, 2025.

  1. Have done

    npm i --save-dev @types/jquery
    npm install --save jquery


    in 'tsconfig.app.json' added

    "compilerOptions": { .., "types": [ .., "jquery" ] }


    in 'angular.json' added

    "scripts": [ "node_modules/jquery/dist/jquery.js", .. ]


    for example i use it in


    declare var $: any;

    ngAfterViewInit(): void {
    const myCarousel = this._carousel.nativeElement;
    const carousel = (<any>$(myCarousel)).carousel();
    }

    It is working but in the prompt of powershell where i've done 'ng serve' got a ERROR ReferenceError: $ is not defined

    Have tryed also to add

    import * as $ from 'jquery'


    but same result.. can anyone help me?

    Continue reading...

Compartilhe esta Página