angular-gem 1.2.19 → 1.2.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,206 @@
1
+ /**
2
+ * @license AngularJS v1.2.20
3
+ * (c) 2010-2014 Google, Inc. http://angularjs.org
4
+ * License: MIT
5
+ */
6
+ (function(window, angular, undefined) {'use strict';
7
+
8
+ /**
9
+ * @ngdoc module
10
+ * @name ngCookies
11
+ * @description
12
+ *
13
+ * # ngCookies
14
+ *
15
+ * The `ngCookies` module provides a convenient wrapper for reading and writing browser cookies.
16
+ *
17
+ *
18
+ * <div doc-module-components="ngCookies"></div>
19
+ *
20
+ * See {@link ngCookies.$cookies `$cookies`} and
21
+ * {@link ngCookies.$cookieStore `$cookieStore`} for usage.
22
+ */
23
+
24
+
25
+ angular.module('ngCookies', ['ng']).
26
+ /**
27
+ * @ngdoc service
28
+ * @name $cookies
29
+ *
30
+ * @description
31
+ * Provides read/write access to browser's cookies.
32
+ *
33
+ * Only a simple Object is exposed and by adding or removing properties to/from this object, new
34
+ * cookies are created/deleted at the end of current $eval.
35
+ * The object's properties can only be strings.
36
+ *
37
+ * Requires the {@link ngCookies `ngCookies`} module to be installed.
38
+ *
39
+ * @example
40
+ *
41
+ * ```js
42
+ * angular.module('cookiesExample', ['ngCookies'])
43
+ * .controller('ExampleController', ['$cookies', function($cookies) {
44
+ * // Retrieving a cookie
45
+ * var favoriteCookie = $cookies.myFavorite;
46
+ * // Setting a cookie
47
+ * $cookies.myFavorite = 'oatmeal';
48
+ * }]);
49
+ * ```
50
+ */
51
+ factory('$cookies', ['$rootScope', '$browser', function ($rootScope, $browser) {
52
+ var cookies = {},
53
+ lastCookies = {},
54
+ lastBrowserCookies,
55
+ runEval = false,
56
+ copy = angular.copy,
57
+ isUndefined = angular.isUndefined;
58
+
59
+ //creates a poller fn that copies all cookies from the $browser to service & inits the service
60
+ $browser.addPollFn(function() {
61
+ var currentCookies = $browser.cookies();
62
+ if (lastBrowserCookies != currentCookies) { //relies on browser.cookies() impl
63
+ lastBrowserCookies = currentCookies;
64
+ copy(currentCookies, lastCookies);
65
+ copy(currentCookies, cookies);
66
+ if (runEval) $rootScope.$apply();
67
+ }
68
+ })();
69
+
70
+ runEval = true;
71
+
72
+ //at the end of each eval, push cookies
73
+ //TODO: this should happen before the "delayed" watches fire, because if some cookies are not
74
+ // strings or browser refuses to store some cookies, we update the model in the push fn.
75
+ $rootScope.$watch(push);
76
+
77
+ return cookies;
78
+
79
+
80
+ /**
81
+ * Pushes all the cookies from the service to the browser and verifies if all cookies were
82
+ * stored.
83
+ */
84
+ function push() {
85
+ var name,
86
+ value,
87
+ browserCookies,
88
+ updated;
89
+
90
+ //delete any cookies deleted in $cookies
91
+ for (name in lastCookies) {
92
+ if (isUndefined(cookies[name])) {
93
+ $browser.cookies(name, undefined);
94
+ }
95
+ }
96
+
97
+ //update all cookies updated in $cookies
98
+ for(name in cookies) {
99
+ value = cookies[name];
100
+ if (!angular.isString(value)) {
101
+ value = '' + value;
102
+ cookies[name] = value;
103
+ }
104
+ if (value !== lastCookies[name]) {
105
+ $browser.cookies(name, value);
106
+ updated = true;
107
+ }
108
+ }
109
+
110
+ //verify what was actually stored
111
+ if (updated){
112
+ updated = false;
113
+ browserCookies = $browser.cookies();
114
+
115
+ for (name in cookies) {
116
+ if (cookies[name] !== browserCookies[name]) {
117
+ //delete or reset all cookies that the browser dropped from $cookies
118
+ if (isUndefined(browserCookies[name])) {
119
+ delete cookies[name];
120
+ } else {
121
+ cookies[name] = browserCookies[name];
122
+ }
123
+ updated = true;
124
+ }
125
+ }
126
+ }
127
+ }
128
+ }]).
129
+
130
+
131
+ /**
132
+ * @ngdoc service
133
+ * @name $cookieStore
134
+ * @requires $cookies
135
+ *
136
+ * @description
137
+ * Provides a key-value (string-object) storage, that is backed by session cookies.
138
+ * Objects put or retrieved from this storage are automatically serialized or
139
+ * deserialized by angular's toJson/fromJson.
140
+ *
141
+ * Requires the {@link ngCookies `ngCookies`} module to be installed.
142
+ *
143
+ * @example
144
+ *
145
+ * ```js
146
+ * angular.module('cookieStoreExample', ['ngCookies'])
147
+ * .controller('ExampleController', ['$cookieStore', function($cookieStore) {
148
+ * // Put cookie
149
+ * $cookieStore.put('myFavorite','oatmeal');
150
+ * // Get cookie
151
+ * var favoriteCookie = $cookieStore.get('myFavorite');
152
+ * // Removing a cookie
153
+ * $cookieStore.remove('myFavorite');
154
+ * }]);
155
+ * ```
156
+ */
157
+ factory('$cookieStore', ['$cookies', function($cookies) {
158
+
159
+ return {
160
+ /**
161
+ * @ngdoc method
162
+ * @name $cookieStore#get
163
+ *
164
+ * @description
165
+ * Returns the value of given cookie key
166
+ *
167
+ * @param {string} key Id to use for lookup.
168
+ * @returns {Object} Deserialized cookie value.
169
+ */
170
+ get: function(key) {
171
+ var value = $cookies[key];
172
+ return value ? angular.fromJson(value) : value;
173
+ },
174
+
175
+ /**
176
+ * @ngdoc method
177
+ * @name $cookieStore#put
178
+ *
179
+ * @description
180
+ * Sets a value for given cookie key
181
+ *
182
+ * @param {string} key Id for the `value`.
183
+ * @param {Object} value Value to be stored.
184
+ */
185
+ put: function(key, value) {
186
+ $cookies[key] = angular.toJson(value);
187
+ },
188
+
189
+ /**
190
+ * @ngdoc method
191
+ * @name $cookieStore#remove
192
+ *
193
+ * @description
194
+ * Remove given cookie
195
+ *
196
+ * @param {string} key Id of the key-value pair to delete.
197
+ */
198
+ remove: function(key) {
199
+ delete $cookies[key];
200
+ }
201
+ };
202
+
203
+ }]);
204
+
205
+
206
+ })(window, window.angular);
@@ -0,0 +1,414 @@
1
+ /**
2
+ * @license AngularJS v1.2.20
3
+ * (c) 2010-2014 Google, Inc. http://angularjs.org
4
+ * License: MIT
5
+ */
6
+
7
+ (function() {'use strict';
8
+
9
+ /**
10
+ * @description
11
+ *
12
+ * This object provides a utility for producing rich Error messages within
13
+ * Angular. It can be called as follows:
14
+ *
15
+ * var exampleMinErr = minErr('example');
16
+ * throw exampleMinErr('one', 'This {0} is {1}', foo, bar);
17
+ *
18
+ * The above creates an instance of minErr in the example namespace. The
19
+ * resulting error will have a namespaced error code of example.one. The
20
+ * resulting error will replace {0} with the value of foo, and {1} with the
21
+ * value of bar. The object is not restricted in the number of arguments it can
22
+ * take.
23
+ *
24
+ * If fewer arguments are specified than necessary for interpolation, the extra
25
+ * interpolation markers will be preserved in the final string.
26
+ *
27
+ * Since data will be parsed statically during a build step, some restrictions
28
+ * are applied with respect to how minErr instances are created and called.
29
+ * Instances should have names of the form namespaceMinErr for a minErr created
30
+ * using minErr('namespace') . Error codes, namespaces and template strings
31
+ * should all be static strings, not variables or general expressions.
32
+ *
33
+ * @param {string} module The namespace to use for the new minErr instance.
34
+ * @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance
35
+ */
36
+
37
+ function minErr(module) {
38
+ return function () {
39
+ var code = arguments[0],
40
+ prefix = '[' + (module ? module + ':' : '') + code + '] ',
41
+ template = arguments[1],
42
+ templateArgs = arguments,
43
+ stringify = function (obj) {
44
+ if (typeof obj === 'function') {
45
+ return obj.toString().replace(/ \{[\s\S]*$/, '');
46
+ } else if (typeof obj === 'undefined') {
47
+ return 'undefined';
48
+ } else if (typeof obj !== 'string') {
49
+ return JSON.stringify(obj);
50
+ }
51
+ return obj;
52
+ },
53
+ message, i;
54
+
55
+ message = prefix + template.replace(/\{\d+\}/g, function (match) {
56
+ var index = +match.slice(1, -1), arg;
57
+
58
+ if (index + 2 < templateArgs.length) {
59
+ arg = templateArgs[index + 2];
60
+ if (typeof arg === 'function') {
61
+ return arg.toString().replace(/ ?\{[\s\S]*$/, '');
62
+ } else if (typeof arg === 'undefined') {
63
+ return 'undefined';
64
+ } else if (typeof arg !== 'string') {
65
+ return toJson(arg);
66
+ }
67
+ return arg;
68
+ }
69
+ return match;
70
+ });
71
+
72
+ message = message + '\nhttp://errors.angularjs.org/1.2.20/' +
73
+ (module ? module + '/' : '') + code;
74
+ for (i = 2; i < arguments.length; i++) {
75
+ message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
76
+ encodeURIComponent(stringify(arguments[i]));
77
+ }
78
+
79
+ return new Error(message);
80
+ };
81
+ }
82
+
83
+ /**
84
+ * @ngdoc type
85
+ * @name angular.Module
86
+ * @module ng
87
+ * @description
88
+ *
89
+ * Interface for configuring angular {@link angular.module modules}.
90
+ */
91
+
92
+ function setupModuleLoader(window) {
93
+
94
+ var $injectorMinErr = minErr('$injector');
95
+ var ngMinErr = minErr('ng');
96
+
97
+ function ensure(obj, name, factory) {
98
+ return obj[name] || (obj[name] = factory());
99
+ }
100
+
101
+ var angular = ensure(window, 'angular', Object);
102
+
103
+ // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap
104
+ angular.$$minErr = angular.$$minErr || minErr;
105
+
106
+ return ensure(angular, 'module', function() {
107
+ /** @type {Object.<string, angular.Module>} */
108
+ var modules = {};
109
+
110
+ /**
111
+ * @ngdoc function
112
+ * @name angular.module
113
+ * @module ng
114
+ * @description
115
+ *
116
+ * The `angular.module` is a global place for creating, registering and retrieving Angular
117
+ * modules.
118
+ * All modules (angular core or 3rd party) that should be available to an application must be
119
+ * registered using this mechanism.
120
+ *
121
+ * When passed two or more arguments, a new module is created. If passed only one argument, an
122
+ * existing module (the name passed as the first argument to `module`) is retrieved.
123
+ *
124
+ *
125
+ * # Module
126
+ *
127
+ * A module is a collection of services, directives, controllers, filters, and configuration information.
128
+ * `angular.module` is used to configure the {@link auto.$injector $injector}.
129
+ *
130
+ * ```js
131
+ * // Create a new module
132
+ * var myModule = angular.module('myModule', []);
133
+ *
134
+ * // register a new service
135
+ * myModule.value('appName', 'MyCoolApp');
136
+ *
137
+ * // configure existing services inside initialization blocks.
138
+ * myModule.config(['$locationProvider', function($locationProvider) {
139
+ * // Configure existing providers
140
+ * $locationProvider.hashPrefix('!');
141
+ * }]);
142
+ * ```
143
+ *
144
+ * Then you can create an injector and load your modules like this:
145
+ *
146
+ * ```js
147
+ * var injector = angular.injector(['ng', 'myModule'])
148
+ * ```
149
+ *
150
+ * However it's more likely that you'll just use
151
+ * {@link ng.directive:ngApp ngApp} or
152
+ * {@link angular.bootstrap} to simplify this process for you.
153
+ *
154
+ * @param {!string} name The name of the module to create or retrieve.
155
+ * @param {!Array.<string>=} requires If specified then new module is being created. If
156
+ * unspecified then the module is being retrieved for further configuration.
157
+ * @param {Function=} configFn Optional configuration function for the module. Same as
158
+ * {@link angular.Module#config Module#config()}.
159
+ * @returns {module} new module with the {@link angular.Module} api.
160
+ */
161
+ return function module(name, requires, configFn) {
162
+ var assertNotHasOwnProperty = function(name, context) {
163
+ if (name === 'hasOwnProperty') {
164
+ throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
165
+ }
166
+ };
167
+
168
+ assertNotHasOwnProperty(name, 'module');
169
+ if (requires && modules.hasOwnProperty(name)) {
170
+ modules[name] = null;
171
+ }
172
+ return ensure(modules, name, function() {
173
+ if (!requires) {
174
+ throw $injectorMinErr('nomod', "Module '{0}' is not available! You either misspelled " +
175
+ "the module name or forgot to load it. If registering a module ensure that you " +
176
+ "specify the dependencies as the second argument.", name);
177
+ }
178
+
179
+ /** @type {!Array.<Array.<*>>} */
180
+ var invokeQueue = [];
181
+
182
+ /** @type {!Array.<Function>} */
183
+ var runBlocks = [];
184
+
185
+ var config = invokeLater('$injector', 'invoke');
186
+
187
+ /** @type {angular.Module} */
188
+ var moduleInstance = {
189
+ // Private state
190
+ _invokeQueue: invokeQueue,
191
+ _runBlocks: runBlocks,
192
+
193
+ /**
194
+ * @ngdoc property
195
+ * @name angular.Module#requires
196
+ * @module ng
197
+ * @returns {Array.<string>} List of module names which must be loaded before this module.
198
+ * @description
199
+ * Holds the list of modules which the injector will load before the current module is
200
+ * loaded.
201
+ */
202
+ requires: requires,
203
+
204
+ /**
205
+ * @ngdoc property
206
+ * @name angular.Module#name
207
+ * @module ng
208
+ * @returns {string} Name of the module.
209
+ * @description
210
+ */
211
+ name: name,
212
+
213
+
214
+ /**
215
+ * @ngdoc method
216
+ * @name angular.Module#provider
217
+ * @module ng
218
+ * @param {string} name service name
219
+ * @param {Function} providerType Construction function for creating new instance of the
220
+ * service.
221
+ * @description
222
+ * See {@link auto.$provide#provider $provide.provider()}.
223
+ */
224
+ provider: invokeLater('$provide', 'provider'),
225
+
226
+ /**
227
+ * @ngdoc method
228
+ * @name angular.Module#factory
229
+ * @module ng
230
+ * @param {string} name service name
231
+ * @param {Function} providerFunction Function for creating new instance of the service.
232
+ * @description
233
+ * See {@link auto.$provide#factory $provide.factory()}.
234
+ */
235
+ factory: invokeLater('$provide', 'factory'),
236
+
237
+ /**
238
+ * @ngdoc method
239
+ * @name angular.Module#service
240
+ * @module ng
241
+ * @param {string} name service name
242
+ * @param {Function} constructor A constructor function that will be instantiated.
243
+ * @description
244
+ * See {@link auto.$provide#service $provide.service()}.
245
+ */
246
+ service: invokeLater('$provide', 'service'),
247
+
248
+ /**
249
+ * @ngdoc method
250
+ * @name angular.Module#value
251
+ * @module ng
252
+ * @param {string} name service name
253
+ * @param {*} object Service instance object.
254
+ * @description
255
+ * See {@link auto.$provide#value $provide.value()}.
256
+ */
257
+ value: invokeLater('$provide', 'value'),
258
+
259
+ /**
260
+ * @ngdoc method
261
+ * @name angular.Module#constant
262
+ * @module ng
263
+ * @param {string} name constant name
264
+ * @param {*} object Constant value.
265
+ * @description
266
+ * Because the constant are fixed, they get applied before other provide methods.
267
+ * See {@link auto.$provide#constant $provide.constant()}.
268
+ */
269
+ constant: invokeLater('$provide', 'constant', 'unshift'),
270
+
271
+ /**
272
+ * @ngdoc method
273
+ * @name angular.Module#animation
274
+ * @module ng
275
+ * @param {string} name animation name
276
+ * @param {Function} animationFactory Factory function for creating new instance of an
277
+ * animation.
278
+ * @description
279
+ *
280
+ * **NOTE**: animations take effect only if the **ngAnimate** module is loaded.
281
+ *
282
+ *
283
+ * Defines an animation hook that can be later used with
284
+ * {@link ngAnimate.$animate $animate} service and directives that use this service.
285
+ *
286
+ * ```js
287
+ * module.animation('.animation-name', function($inject1, $inject2) {
288
+ * return {
289
+ * eventName : function(element, done) {
290
+ * //code to run the animation
291
+ * //once complete, then run done()
292
+ * return function cancellationFunction(element) {
293
+ * //code to cancel the animation
294
+ * }
295
+ * }
296
+ * }
297
+ * })
298
+ * ```
299
+ *
300
+ * See {@link ngAnimate.$animateProvider#register $animateProvider.register()} and
301
+ * {@link ngAnimate ngAnimate module} for more information.
302
+ */
303
+ animation: invokeLater('$animateProvider', 'register'),
304
+
305
+ /**
306
+ * @ngdoc method
307
+ * @name angular.Module#filter
308
+ * @module ng
309
+ * @param {string} name Filter name.
310
+ * @param {Function} filterFactory Factory function for creating new instance of filter.
311
+ * @description
312
+ * See {@link ng.$filterProvider#register $filterProvider.register()}.
313
+ */
314
+ filter: invokeLater('$filterProvider', 'register'),
315
+
316
+ /**
317
+ * @ngdoc method
318
+ * @name angular.Module#controller
319
+ * @module ng
320
+ * @param {string|Object} name Controller name, or an object map of controllers where the
321
+ * keys are the names and the values are the constructors.
322
+ * @param {Function} constructor Controller constructor function.
323
+ * @description
324
+ * See {@link ng.$controllerProvider#register $controllerProvider.register()}.
325
+ */
326
+ controller: invokeLater('$controllerProvider', 'register'),
327
+
328
+ /**
329
+ * @ngdoc method
330
+ * @name angular.Module#directive
331
+ * @module ng
332
+ * @param {string|Object} name Directive name, or an object map of directives where the
333
+ * keys are the names and the values are the factories.
334
+ * @param {Function} directiveFactory Factory function for creating new instance of
335
+ * directives.
336
+ * @description
337
+ * See {@link ng.$compileProvider#directive $compileProvider.directive()}.
338
+ */
339
+ directive: invokeLater('$compileProvider', 'directive'),
340
+
341
+ /**
342
+ * @ngdoc method
343
+ * @name angular.Module#config
344
+ * @module ng
345
+ * @param {Function} configFn Execute this function on module load. Useful for service
346
+ * configuration.
347
+ * @description
348
+ * Use this method to register work which needs to be performed on module loading.
349
+ * For more about how to configure services, see
350
+ * {@link providers#providers_provider-recipe Provider Recipe}.
351
+ */
352
+ config: config,
353
+
354
+ /**
355
+ * @ngdoc method
356
+ * @name angular.Module#run
357
+ * @module ng
358
+ * @param {Function} initializationFn Execute this function after injector creation.
359
+ * Useful for application initialization.
360
+ * @description
361
+ * Use this method to register work which should be performed when the injector is done
362
+ * loading all modules.
363
+ */
364
+ run: function(block) {
365
+ runBlocks.push(block);
366
+ return this;
367
+ }
368
+ };
369
+
370
+ if (configFn) {
371
+ config(configFn);
372
+ }
373
+
374
+ return moduleInstance;
375
+
376
+ /**
377
+ * @param {string} provider
378
+ * @param {string} method
379
+ * @param {String=} insertMethod
380
+ * @returns {angular.Module}
381
+ */
382
+ function invokeLater(provider, method, insertMethod) {
383
+ return function() {
384
+ invokeQueue[insertMethod || 'push']([provider, method, arguments]);
385
+ return moduleInstance;
386
+ };
387
+ }
388
+ });
389
+ };
390
+ });
391
+
392
+ }
393
+
394
+ setupModuleLoader(window);
395
+ })(window);
396
+
397
+ /**
398
+ * Closure compiler type information
399
+ *
400
+ * @typedef { {
401
+ * requires: !Array.<string>,
402
+ * invokeQueue: !Array.<Array.<*>>,
403
+ *
404
+ * service: function(string, Function):angular.Module,
405
+ * factory: function(string, Function):angular.Module,
406
+ * value: function(string, *):angular.Module,
407
+ *
408
+ * filter: function(string, Function):angular.Module,
409
+ *
410
+ * init: function(Function):angular.Module
411
+ * } }
412
+ */
413
+ angular.Module;
414
+