From 1c0b11bbf01e0a961cf730d04be04b747ea95c7a Mon Sep 17 00:00:00 2001 From: Corey Cacic Date: Fri, 4 Nov 2016 10:03:39 +1000 Subject: [PATCH] docs($cookiesProvider): provided example on how to use the provider Provided an example on how to use the $cookiesProvider to set default behaviour. Many similar services support overriding the `defaults` object with a new one, where this service only supports changing individual properties one at a time. --- src/ngCookies/cookies.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ngCookies/cookies.js b/src/ngCookies/cookies.js index aed65b1859c6..547a781d995e 100644 --- a/src/ngCookies/cookies.js +++ b/src/ngCookies/cookies.js @@ -46,6 +46,16 @@ angular.module('ngCookies', ['ng']). * Note: By default, the address that appears in your `` 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 = {};