Sunday 10 June 2018

ERROR ReferenceError: is not defined in angular 4

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,

 removeCity = function(index) {

        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

Extract error records while inserting into db table using JDBCIO apache beam in java

 I was inserting data into postgres db using apache beam pipeline. it works perfectly with JdbcIO write of apache beam library. But, now, i ...