How to use boostrap's js,typescript in angular5 to compile an error, and how to solve it?

using $("- sharpid"). Modal ("open") Times error is as follows:

ERROR in src/app/components/navbar/navbar.component.ts(77,5): error TS2304: Cannot find name "$".

add a reference

import * as $ from "jquery";

use $("- sharpid"). Modal ("open") or report an error:

ERROR in src/app/components/navbar/navbar.component.ts(77,21): error TS2339: Property "modal" does not exist on type "JQuery<HTMLElement>".

could you tell me how to solve the problem?


try npm install-- save @ types/jquery . It should be that the type description file of jquery is not loaded


replace import * as $from 'jquery'; with declare var $: any; should work

Menu