$scope.myVar = cheese;
function please(){
$scope.myVar = "New Value";
}
google.maps.event.addListener(marker, 'click', please);
This scenario is perplexing to me. I have a variable called "cheese" in the HTML and I anticipated that clicking on a Google marker would update it to "New Value" similar to how ng-click works.
However, when I added an alert inside the function, it correctly displayed "New Value", but this value did not persist outside of the function.
I experimented with different approaches:
myVar = "New Value"
var myVar = "New Value"
I suspect the issue may stem from confusion between global and local variables. As someone new to Angular, I find this aspect particularly challenging to grasp.
Thank you for any help or clarification.