Why are there two `$scope.update` functions?