check scope.$root.$$phase before $apply

I used the uiSelect2 directive in another directive with isolated scope, and this modification avoid "$digest already in progress" error.