Bootstrap modal: is not a function

后端 未结 13 2204
滥情空心
滥情空心 2020-12-02 17:45

I have a modal in my page. When I try to call it when the windows load, it prints an error to the console that says :

$(...).modal is not a function
         


        
13条回答
  •  半阙折子戏
    2020-12-02 18:41

    I meet this error when integrate modal bootstrap in angular.

    This is my solution to solve this issue.

    I share for whom concern.

    First step you need install jquery and bootstrap by npm command.

    Second you need add declare var $ : any; in component

    And use can use $('#myModal').modal('hide'); on onSave() method

    Demo https://stackblitz.com/edit/angular-model-bootstrap-close?file=src/app/app.component.ts

提交回复
热议问题