docs($cookiesProvider): add example for overwriting defaults on provider

Add an example on how to set default values on `$cookiesProvider`. Many similar services support
overriding the `defaults` object with a new one, but this service only supports changing individual
properties.

Closes #15362
This commit is contained in:
Corey Cacic
2016-11-04 10:03:39 +10:00
committed by Georgios Kalpakas
parent d71788455d
commit 6d3329479f
+10
View File
@@ -46,6 +46,16 @@ angular.module('ngCookies', ['ng']).
* Note: By default, the address that appears in your `<base>` tag will be used as the path.
* This is important so that cookies will be visible for all routes when html5mode is enabled.
*
* @example
*
* ```js
* angular.module('cookiesProviderExample', ['ngCookies'])
* .config(['$cookiesProvider', function($cookiesProvider) {
* // Setting default options
* $cookiesProvider.defaults.domain = 'foo.com';
* $cookiesProvider.defaults.secure = true;
* }]);
* ```
**/
var defaults = this.defaults = {};