I am using angular and jquery float to draw a graph. Graph is canvas element.
I want to re-draw a canvas on click of some icon..
clicked handler is toggleSideMenu
. OnClick ngClick
of icon we are broadcasting
the refresh
event. But Its not working.
If I will put debbugger inside the function it works..
My JS Code-
this.toggleSideMenu = function () {
// this.setSideMenuState(!this.sidemenu);
$("#sidemenu-canvas").toggleClass("toggled");
$timeout(function () {
$rootScope.$broadcast("refresh");
}, 50);
$timeout(function () {
$rootScope.$broadcast("render");
}, 50);
};
Instead of giving -
$timeout(function () {
$rootScope.$broadcast("refresh");
}, 50);
I have given
$rootScope.$broadcast("refresh");
I have listner also-
$scope.$on('refresh', function() {
if(!$scope.isDRPDisabled) {
$scope.refresh();
});
But its not working. Please help me..