I work on angular 7 app I face Issue when filter data using data[0][this.fieldnamefilter] it give me N/A
I filter data by using variable fieldnamefilter
below code is give n/a on this.fieldnamefilter function filter :
contentBody:any[];
fieldnamefilter:any;
data is have datatype any[];
console.log("data values : "+this.fieldnamefilter )//result is data values : onlineURL on console log// when use data[0][this.fieldnamefilter] it give me N/Athis.contentBody = data.filter(item =>item != data[0][this.fieldnamefilter]);
but If I use it as data[0].onlineURL it working ;//working when use field name direct data[0].onlineURLthis.contentBody = data.filter(item =>item != data[0].onlineURL);
so How to solve this issue ;
Updated post I try :
console.log(this.fieldnamefilter it give me onlineURL
when use field name direct it work but on my case i stored filter name on variable
so how to use variable name on data[0].variable have filter
if you store a field in that variable, you can use it like this:
Member
39 Points
363 Posts
when filter data by using fieldnamefilter variable it give me 'N/A' but It work using static word...
Jun 08, 2020 10:12 PM|ahmedbarbary|LINK
I work on angular 7 app I face Issue when filter data using data[0][this.fieldnamefilter] it give me N/A
I filter data by using variable fieldnamefilter
below code is give n/a on this.fieldnamefilter function filter :
so How to solve this issue ;
Updated post I try :
when use field name direct it work but on my case i stored filter name on variable
so how to use variable name on data[0].variable have filter
if you store a field in that variable, you can use it like this: