I have an angular HTML file, an angularjs controller file and a simple JavaScript file.
Angular HTML file is something like
<section data-ng-controller="myCtrl">
{{name}}
<button id="btn1">Button1</button>
</section>
Angularjs controller file is like
angular.module('users').controller('myCtrl', ['$scope',
function($scope) {
$scope.name="HELLO";
}]);
and a simple JavaScript file like
<script>
document.getElementById("btn1").addEventListener("click",function(){
// code????? that can change the $scope.name variable to "changed"
});
</script>
the html file will initially look like
HELLO
<button>
I want the functionality that on clicking the button it should change to something like
changed
<button>
Is there any way to change the $scope variable in angular part from a separate JavaScript file containing a regular event listener?
How to code the JavaScript part for this?