angular-gem 1.2.24 → 1.2.25

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.25
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,415 @@
1
+ /**
2
+ * @license AngularJS v1.2.25
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.25/' +
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
+ *
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
+ *
209
+ * @description
210
+ * Name of the module.
211
+ */
212
+ name: name,
213
+
214
+
215
+ /**
216
+ * @ngdoc method
217
+ * @name angular.Module#provider
218
+ * @module ng
219
+ * @param {string} name service name
220
+ * @param {Function} providerType Construction function for creating new instance of the
221
+ * service.
222
+ * @description
223
+ * See {@link auto.$provide#provider $provide.provider()}.
224
+ */
225
+ provider: invokeLater('$provide', 'provider'),
226
+
227
+ /**
228
+ * @ngdoc method
229
+ * @name angular.Module#factory
230
+ * @module ng
231
+ * @param {string} name service name
232
+ * @param {Function} providerFunction Function for creating new instance of the service.
233
+ * @description
234
+ * See {@link auto.$provide#factory $provide.factory()}.
235
+ */
236
+ factory: invokeLater('$provide', 'factory'),
237
+
238
+ /**
239
+ * @ngdoc method
240
+ * @name angular.Module#service
241
+ * @module ng
242
+ * @param {string} name service name
243
+ * @param {Function} constructor A constructor function that will be instantiated.
244
+ * @description
245
+ * See {@link auto.$provide#service $provide.service()}.
246
+ */
247
+ service: invokeLater('$provide', 'service'),
248
+
249
+ /**
250
+ * @ngdoc method
251
+ * @name angular.Module#value
252
+ * @module ng
253
+ * @param {string} name service name
254
+ * @param {*} object Service instance object.
255
+ * @description
256
+ * See {@link auto.$provide#value $provide.value()}.
257
+ */
258
+ value: invokeLater('$provide', 'value'),
259
+
260
+ /**
261
+ * @ngdoc method
262
+ * @name angular.Module#constant
263
+ * @module ng
264
+ * @param {string} name constant name
265
+ * @param {*} object Constant value.
266
+ * @description
267
+ * Because the constant are fixed, they get applied before other provide methods.
268
+ * See {@link auto.$provide#constant $provide.constant()}.
269
+ */
270
+ constant: invokeLater('$provide', 'constant', 'unshift'),
271
+
272
+ /**
273
+ * @ngdoc method
274
+ * @name angular.Module#animation
275
+ * @module ng
276
+ * @param {string} name animation name
277
+ * @param {Function} animationFactory Factory function for creating new instance of an
278
+ * animation.
279
+ * @description
280
+ *
281
+ * **NOTE**: animations take effect only if the **ngAnimate** module is loaded.
282
+ *
283
+ *
284
+ * Defines an animation hook that can be later used with
285
+ * {@link ngAnimate.$animate $animate} service and directives that use this service.
286
+ *
287
+ * ```js
288
+ * module.animation('.animation-name', function($inject1, $inject2) {
289
+ * return {
290
+ * eventName : function(element, done) {
291
+ * //code to run the animation
292
+ * //once complete, then run done()
293
+ * return function cancellationFunction(element) {
294
+ * //code to cancel the animation
295
+ * }
296
+ * }
297
+ * }
298
+ * })
299
+ * ```
300
+ *
301
+ * See {@link ngAnimate.$animateProvider#register $animateProvider.register()} and
302
+ * {@link ngAnimate ngAnimate module} for more information.
303
+ */
304
+ animation: invokeLater('$animateProvider', 'register'),
305
+
306
+ /**
307
+ * @ngdoc method
308
+ * @name angular.Module#filter
309
+ * @module ng
310
+ * @param {string} name Filter name.
311
+ * @param {Function} filterFactory Factory function for creating new instance of filter.
312
+ * @description
313
+ * See {@link ng.$filterProvider#register $filterProvider.register()}.
314
+ */
315
+ filter: invokeLater('$filterProvider', 'register'),
316
+
317
+ /**
318
+ * @ngdoc method
319
+ * @name angular.Module#controller
320
+ * @module ng
321
+ * @param {string|Object} name Controller name, or an object map of controllers where the
322
+ * keys are the names and the values are the constructors.
323
+ * @param {Function} constructor Controller constructor function.
324
+ * @description
325
+ * See {@link ng.$controllerProvider#register $controllerProvider.register()}.
326
+ */
327
+ controller: invokeLater('$controllerProvider', 'register'),
328
+
329
+ /**
330
+ * @ngdoc method
331
+ * @name angular.Module#directive
332
+ * @module ng
333
+ * @param {string|Object} name Directive name, or an object map of directives where the
334
+ * keys are the names and the values are the factories.
335
+ * @param {Function} directiveFactory Factory function for creating new instance of
336
+ * directives.
337
+ * @description
338
+ * See {@link ng.$compileProvider#directive $compileProvider.directive()}.
339
+ */
340
+ directive: invokeLater('$compileProvider', 'directive'),
341
+
342
+ /**
343
+ * @ngdoc method
344
+ * @name angular.Module#config
345
+ * @module ng
346
+ * @param {Function} configFn Execute this function on module load. Useful for service
347
+ * configuration.
348
+ * @description
349
+ * Use this method to register work which needs to be performed on module loading.
350
+ * For more about how to configure services, see
351
+ * {@link providers#providers_provider-recipe Provider Recipe}.
352
+ */
353
+ config: config,
354
+
355
+ /**
356
+ * @ngdoc method
357
+ * @name angular.Module#run
358
+ * @module ng
359
+ * @param {Function} initializationFn Execute this function after injector creation.
360
+ * Useful for application initialization.
361
+ * @description
362
+ * Use this method to register work which should be performed when the injector is done
363
+ * loading all modules.
364
+ */
365
+ run: function(block) {
366
+ runBlocks.push(block);
367
+ return this;
368
+ }
369
+ };
370
+
371
+ if (configFn) {
372
+ config(configFn);
373
+ }
374
+
375
+ return moduleInstance;
376
+
377
+ /**
378
+ * @param {string} provider
379
+ * @param {string} method
380
+ * @param {String=} insertMethod
381
+ * @returns {angular.Module}
382
+ */
383
+ function invokeLater(provider, method, insertMethod) {
384
+ return function() {
385
+ invokeQueue[insertMethod || 'push']([provider, method, arguments]);
386
+ return moduleInstance;
387
+ };
388
+ }
389
+ });
390
+ };
391
+ });
392
+
393
+ }
394
+
395
+ setupModuleLoader(window);
396
+ })(window);
397
+
398
+ /**
399
+ * Closure compiler type information
400
+ *
401
+ * @typedef { {
402
+ * requires: !Array.<string>,
403
+ * invokeQueue: !Array.<Array.<*>>,
404
+ *
405
+ * service: function(string, Function):angular.Module,
406
+ * factory: function(string, Function):angular.Module,
407
+ * value: function(string, *):angular.Module,
408
+ *
409
+ * filter: function(string, Function):angular.Module,
410
+ *
411
+ * init: function(Function):angular.Module
412
+ * } }
413
+ */
414
+ angular.Module;
415
+