Ad
Property Control Name Does Not Exist On Type Any[] When Pass ControlName To Another Array?
I have two array
first filter list array and represent by filterlist controlName
second filter bind and represent by filter bind filterName
my issue i face is cannot pass filter list control name to filter bind filterName
it show to me error property control name does not exist on type any[] ?
error display on line of
this.tempFilter=this.FilterBinddata.filter(x=>x.filterName==this.FilterList.controlName) ;
so how to solve this issue
FilterList:any[]=[];
FilterBinddata=any[]=[];
tempFilter=any[]=[];
this._displayreport.GetReportFilteresById(param2).subscribe((data: any[]) => {
this.FilterList = data;
});
this._displayreport.GetReportFilterBind(param2).subscribe((data2: any[]) => {
this.FilterBinddata = data2;
this.tempFilter=this.FilterBinddata.filter(x=>x.filterName==this.FilterList.controlName) ;
filter list data returned
datalistfilter [{"controlName":"ddlCompanyName","visableFlag":1},{"controlName":"ddlRegulation","visableFlag":1}]
filter bind data returned as
{"filterName":"ddlCompanyName","reportSource":"ZPower","reportSource2":"Text1"},{"filterName":"ddlCompanyName","reportSource":"ZYWYN Corporation","reportSource2":"Text1"},{"filterName":"ddlRegulation","reportSource":"ChinaROHS","reportSource2":"Text2"},{"filterName":"ddlRegulation","reportSource":"HalogenFree","reportSource2":"Text2"}
Ad
Answer
You can use any of this two quick Fix to overcome the error message
this.tempFilter=this.FilterBinddata.filter(x=>x.filterName==(this.FilterList as any).controlName);
OR
this.tempFilter=this.FilterBinddata.filter(x=>x.filterName==this.FilterList["controlName"]);
Ad
source: stackoverflow.com
Related Questions
- → How to update data attribute on Ajax complete
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → Octobercms Component Unique id (Twig & Javascript)
- → Passing a JS var from AJAX response to Twig
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → DropzoneJS & Laravel - Output form validation errors
- → Import statement and Babel
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM
Ad