Copied some changes from pull request 12.

https://github.com/wspringer/angular-pouchdb/pull/12
Merge branch 'master' of github.com:wspringer/angular-pouchdb