test/lib/angular/angular-cookies.js in angularjs-rails-resource-1.0.0.pre.4 vs test/lib/angular/angular-cookies.js in angularjs-rails-resource-1.0.0

- old
+ new

@@ -1,16 +1,27 @@ /** - * @license AngularJS v1.1.4 - * (c) 2010-2012 Google, Inc. http://angularjs.org + * @license AngularJS v1.2.6 + * (c) 2010-2014 Google, Inc. http://angularjs.org * License: MIT */ -(function(window, angular, undefined) { -'use strict'; +(function(window, angular, undefined) {'use strict'; /** * @ngdoc overview * @name ngCookies + * @description + * + * # ngCookies + * + * The `ngCookies` module provides a convenient wrapper for reading and writing browser cookies. + * + * {@installModule cookies} + * + * <div doc-module-components="ngCookies"></div> + * + * See {@link ngCookies.$cookies `$cookies`} and + * {@link ngCookies.$cookieStore `$cookieStore`} for usage. */ angular.module('ngCookies', ['ng']). /** @@ -22,10 +33,12 @@ * Provides read/write access to browser's cookies. * * Only a simple Object is exposed and by adding or removing properties to/from * this object, new cookies are created/deleted at the end of current $eval. * + * Requires the {@link ngCookies `ngCookies`} module to be installed. + * * @example <doc:example> <doc:source> <script> function ExampleController($cookies) { @@ -66,11 +79,12 @@ return cookies; /** - * Pushes all the cookies from the service to the browser and verifies if all cookies were stored. + * Pushes all the cookies from the service to the browser and verifies if all cookies were + * stored. */ function push() { var name, value, browserCookies, @@ -126,10 +140,13 @@ * * @description * Provides a key-value (string-object) storage, that is backed by session cookies. * Objects put or retrieved from this storage are automatically serialized or * deserialized by angular's toJson/fromJson. + * + * Requires the {@link ngCookies `ngCookies`} module to be installed. + * * @example */ factory('$cookieStore', ['$cookies', function($cookies) { return { @@ -143,10 +160,11 @@ * * @param {string} key Id to use for lookup. * @returns {Object} Deserialized cookie value. */ get: function(key) { - return angular.fromJson($cookies[key]); + var value = $cookies[key]; + return value ? angular.fromJson(value) : value; }, /** * @ngdoc method * @name ngCookies.$cookieStore#put