safeApply angular

来源:互联网 发布:2013cctv网络春晚韩庚 编辑:程序博客网 时间:2024/06/06 01:48
function safeApply(fn) {    var phase = this.$root.$$phase;    if (phase == '$apply' || phase == '$digest') {        if (fn && (typeof(fn) === 'function')) {            fn();        }    } else {        this.$apply(fn);    }}
0 0