Issue
hello to all I would like to know how I can get a value that I have in a subcribe pass it to a variable and be able to manipulate it example
getNumber: number;
i want in the same .ts to use that variable getNumber
someMethodTwo() {
this.someMethod().subscribe(data =>
Swal.fire({
position: 'top-end',
icon: 'success',
title: 'it's is the variable '+ getNumber ,
showConfirmButton: false,
timer: 1500
})
}
someMethodOne() {
this.someMethod().subscribe(data =>
this.getNumber= data);
}
Solution
if someMethod returns an observable you can use
.pipe(map(value => {
// manipulate value here and return it
}
)).subscribe((value) => {
this.yourlocalvaribale = value
)
Answered By - ilay Tertman
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.