Beginner with both NativeScript and Typescript. I am trying to access a variable that gets declared in a function, so I can display it in the view. If thats not possible, then how should I fix it
TypeScript code:
onValueEvent(result) {
var cardtitle = result.value.title; // variable I am trying to access in view
console.log(cardtitle); // logs expected value
}
getCardData(cardID: string) {
firebase.addValueEventListener(this.onValueEvent, "/cards/" + cardID).then(
function (listenerWrapper) {
var path = listenerWrapper.path;
var listeners = listenerWrapper.listeners;
});
}
Thanks in advance!
Yes because you don´t use a arrow function