I am using angular-cli to create a project that uses some of the bootstrap js functions like button() and modal(), but the problem is that while I am able to compile my ts file perfectly when I actually try to execute the javascript function in the browser it fails with
error_handler.js:53 TypeError: button.button is not a function
at NewdeviceComponent.loading (newdevice.component.ts:122)
at NewdeviceComponent.add (newdevice.component.ts:97)
at CompiledTemplate.proxyViewClass.View_NewdeviceComponent0.handleEvent_67 (component.ngfactory.js:517)
at CompiledTemplate.proxyViewClass.<anonymous> (view.js:408)
at HTMLButtonElement.<anonymous> (dom_renderer.js:276)
at ZoneDelegate.invokeTask (zone.js:265)
at Object.onInvokeTask (ng_zone.js:227)
at ZoneDelegate.invokeTask (zone.js:264)
at Zone.runTask (zone.js:154)
at HTMLButtonElement.ZoneTask.invoke (zone.js:335)
I am invoking the button function on after a click event like the following-:
button.button(loading ? 'loading' : 'reset');
The weird part is that VSCode gives me intelli sense and compilation actually succeeds but fails in the browser.
All the bootstrap files and styles sheets are globally loaded from the angular-cli.json.
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/bootstrap/dist/js/bootstrap.min.js"
]