Property 'sumo' does not exist on type 'HTMLElement' for SumoSelect JQuery

774 Views Asked by At

I am trying to implement a "clear" or "reset" functionality for my SumoSelect dropdown I have implemented. I am using Angular 4. This is my code I call when I want to clear the dropdown:

 var num = $('option').length;
 for(var i=0; i<num; i++){
   $('#state')[0].sumo.unSelectItem(i);
 }

I installed SumoSelect in my node_modules as well as putting this in my typings.d.ts:

interface JQuery {
   SumoSelect(any):void;

}

In my .angular-cli.json I also included the appropriate js and css files. My SumoSelect dropdown works fine but I can't figure out how to get my application to recognize sumo on the third line of my first code segment. I have tried other interfaces for JQuery and HTMLElement and no luck.

1

There are 1 best solutions below

9
On BEST ANSWER

Try importing sumo in the component.

import  * as sumo from 'SumoSelect'; 

and import * as $ from 'jquery';

or just do this

`declare var $ : any ;` //in the component