TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ahmed elbarbary
NA
1.6k
278k
How to pass data from component to another on angular 7 ?
May 10 2020 3:11 AM
How to pass data from component to another on angular 7 ?
I work on angular 7 i need when click button transfer data from current component to another component
displayreportservice.ts
GetSpByRevisionId(datarevision : any){
return
this
.http.post<any>(
'http://localhost:61265/api/report'
,datarevision)
}
currentcomponent.html
<td> <button (click)=
"getDataByRevision(rep[0])"
>Download</button> </td>
currentcomponent.ts
ReportData:any={};
getDataByRevision(RevId : any)
{
console.log(
"REVEISIONID IS "
+ RevId);
console.log(
this
.ReportData);
this
.ReportData.forEach(
function
(e) { e.revisionID=RevId });
this
._displayreport.GetSpByRevisionId(
this
.ReportData).subscribe(async data=>{
console.log(data)
await
this
.exportJsonAsExcelFile(data ,
'datarevision'
);
});
//console.log(this.reportdetailslist);
}
How to transfer data from component above to target component when click button :
targetcomponent.ts
export
class
ReportCategoryComponent
implements
OnInit {
//reportlist:report[];
datalis:string;
reportlist:any[];
subreportlist:any[];
searchData:any={};
constructor(
public
http: HttpClient,
private
_router: Router,
private
_displayreport: DisplayreportService) { }
ngOnInit() {
//here i need to get data of getdatabyrevisionfunction
//meaning i need to get result of
this
.exportJsonAsExcelFile(data ,
'datarevision'
); here
}
}
How to transfer data from current component.ts to target component.ts
Reply
Answers (
1
)
when export data to excel error excel file not readable cont
when click page number on paging angular 7 it accumulate ?