Closed razzu closed 7 years ago
This typically occurs if the bootstrap javascript is missing or hasn't been loaded before your modal code. Your html snippet above, is it from the head? Are you seeing any http errors in your dev tools (404, etc)?
All of this was from the head, yes.
I've done some more experimenting with the order of various scripts after I read your answer, and it appears that the problem was from some external libraries (related to an odoo module, im_livechat, that we're trying to interface with).
Apparently, having these two lines:
<script type="text/javascript" src="/static/im_livechat/external_lib.js"></script>
<script type="text/javascript" src="/static/im_livechat/loader/3"></script>
after loading the bootstrap javascript was what was causing the problems. I've bumped them above my line that loads bootstrap.min.js and now it seems to be working.
So, all in all, I guess I should have just tried a bit harder, as this doesn't seem to be really related to ng2-bs3-modal. Sorry for the unnecessary posts and thank you for your time!
No problem, glad I could be of some help!
Better solution will be
Install jquery and bootstrap in your project
npm install jquery npm install bootstrap
then import both in the file (for eg model-view.component.ts) where you are using this modal import 'jquery'; import 'bootstrap';
For me this worked flawlessly :)
Ankita-Jaiswal - thanks, it helped me a lot!
@Ankita-Jaiswal I am facing same issue. I have included both jquery and bootstrap in my angular project but still it is not working.
Hello! I've been developing a feature for a project using ng2-bs3-modal, and when getting ready to merge to master I've run into this error when trying to open modals:
TypeError: this.$modal.modal is not a function
at ModalInstance.show (modal-instance.js:37)
at ModalInstance.open (modal-instance.js:15)
at ModalComponent.open
I've looked at some other similar issues but haven't been able to fix this yet. I'm not sure if it's directly related to this module or something else, but it would be great if someone could be able to give me a nudge in the right direction.
Here are the contents of package.json:
And here is part of the index.html file:
Thanks in advance, and sorry if this is not the right place for this issue or if relevant information is missing!