softwaretailoring / wheelnav

Animated wheel navigation JavaScript library based on Raphaël.js (SVG/VML). It can be a pie menu (radial menu, circular menu) and many more.
https://wheelnavjs.softwaretailoring.net
MIT License
700 stars 101 forks source link

calling angular services from navigateFunction #67

Closed sumeetddubey closed 6 years ago

sumeetddubey commented 6 years ago

Hi, I am trying to execute a function and navigate to another page after a wheelnav menu item is clicked. But this doesn't seem to work. My code is below:

wheel.navItems[0].navigateFunction= function(){ $rootScope.$broadcast('myFunction', { data: 'data' }); $location.url('/myPage'); };

I tried logging to console in this function and thats working so the function is executing. Can you help in pointing out whats wrong?

Thanks a lot.

softwaretailoring commented 6 years ago

Did you try wheelnav as a scope variable? $scope.wheel

sumeetddubey commented 6 years ago

No luck with scope

sumeetddubey commented 6 years ago

Resolved it! Adding $scope.$apply() at the end of the function did the trick. Thanks :)