У меня есть функция "function1", которая находится в "testComponent", у меня есть другая функция "function2" в "test2component", в function2 у меня есть переменная "a = 10", я хочу получить доступ к этому значению "a" в «function1», как я могу это сделать.
мой код:
test2Component
a
function2(post_data){
this.service.postUser(post_data).subscribe(respone=>{
return this.a = '10'
});
}
testComponent:
constructor(public usrcpmt : test2Component){
console.log( this.usrcpmt.a);
}
Я пробовал таким образом, значение «a» печатает Undefined