model update done inside scope.$apply

Placed the update of the model inside a scope.$apply in order to have the model properly update any other UI elements dependent on it. (Checked and now external UI elements dependent on the model are properly updated).