Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5c23029

Browse files
committed
docs($cookies): update examples to use modules
1 parent 7c84e26 commit 5c23029

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

src/ngCookies/cookies.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,13 @@ angular.module('ngCookies', ['ng']).
3434
* @example
3535
*
3636
* ```js
37-
* function ExampleController($cookies) {
38-
* // Retrieving a cookie
39-
* var favoriteCookie = $cookies.myFavorite;
40-
* // Setting a cookie
41-
* $cookies.myFavorite = 'oatmeal';
42-
* }
37+
* angular.module('cookiesExample', ['ngCookies'])
38+
* .controller('ExampleController', ['$cookies', function($cookies) {
39+
* // Retrieving a cookie
40+
* var favoriteCookie = $cookies.myFavorite;
41+
* // Setting a cookie
42+
* $cookies.myFavorite = 'oatmeal';
43+
* }]);
4344
* ```
4445
*/
4546
factory('$cookies', ['$rootScope', '$browser', function ($rootScope, $browser) {
@@ -137,14 +138,15 @@ angular.module('ngCookies', ['ng']).
137138
* @example
138139
*
139140
* ```js
140-
* function ExampleController($cookies) {
141-
* // Put cookie
142-
* $cookieStore.put('myFavorite','oatmeal');
143-
* // Get cookie
144-
* var favoriteCookie = $cookieStore.get('myFavorite');
145-
* // Removing a cookie
146-
* $cookieStore.remove('myFavorite');
147-
* }
141+
* angular.module('cookieStoreExample', ['ngCookies'])
142+
* .controller('ExampleController', ['$cookieStore', function($cookieStore) {
143+
* // Put cookie
144+
* $cookieStore.put('myFavorite','oatmeal');
145+
* // Get cookie
146+
* var favoriteCookie = $cookieStore.get('myFavorite');
147+
* // Removing a cookie
148+
* $cookieStore.remove('myFavorite');
149+
* }]);
148150
* ```
149151
*/
150152
factory('$cookieStore', ['$cookies', function($cookies) {

0 commit comments

Comments
 (0)