Skip to content

Instantly share code, notes, and snippets.

@stakach
stakach / gist:5335327
Created April 8, 2013 08:57
AngularJS Mobile + Desktop Events
(function(angular, undefined) {
'use strict';
angular.module('Core.SafeApply', []).
service('Core.SafeApply', function() {
this.do = function(scope, fn) {
var phase = scope.$root.$$phase;
if(phase == '$apply' || phase == '$digest') {
fn();