My angular app code:
(function() {
var app = angular.module('checkout', []);
app.controller('TabController', function(){
this.tab2Done=0;
this.setTab2Done= function(newValue){
this.tab2Done = newValue;
};
});
})();
I want to call tab2Done
from the JavaScript function(function name call). I found a solution on the internet and I tried that method but it's not working. This is the method that I tried:
The div which have has ng-controller="TabController"
has id="yourControllerElementID"
This is my javascript function:
function call(){
alert();
e=$('#yourControllerElementID');
scope=angular.element(e).scope();
scope.$apply(function(){
scope.setTab2Done(1);
});
}
but I got an error:
at Scope.$eval at Scope.$apply
What have I done wrong?