model update in 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.