# angular.service.$defer

Work in Progress This page is currently being revised. It might be incomplete or contain inaccuracies.

## Description

Delegates to `$browser.defer`, but wraps the `fn` function into a try/catch block and delegates any exceptions to `$exceptionHandler` service.

In tests you can use `$browser.defer.flush()` to flush the queue of deferred functions.

## Dependencies

- `$browser`
- `$exceptionHandler`
- `$updateView`

## Usage

    $defer(fn[, delay]);

### Parameters

- `fn – {function()} –`

  A function, who's execution should be deferred.

- `delay(optional=0) – {number} –`

  of milliseconds to defer the function execution.