ERROR ReferenceError: is not defined
Hi, I was adding click event function in angular 4 components html. below is the code for the same.
<span (click)="removeCity(idx)" >remove</span>
and in component ts file, function written as,
this.cityList.splice(index, 1);
}
Where cityList is a array of cities defined in ts file.
But, when I was runing the code, I was getting "ERROR ReferenceError: is not defined in" Then, did followed below steps from terminal to import jquery in app.module.ts
$ npm i jquery --save
$ npm i @types/jquery -D
and imported 'import * as $ from 'jquery';' in app.module.ts
Now, error is vanished.
No comments:
Post a Comment