I have created a plunkr, as you can see I have called the functions once from $scope.init
which works as expected where as when I create a separate
function exec(){
this.data = "234"
function es5(){
console.log(this.data) //<-- Has access ?
}
es5();
es6 = () => {
console.log(this.data)
}
es6();
}
and called it from $scope.init
, the function has access to this
Take a look at console
of browser once the plunker is loaded