angularjs-rails 1.2.14 → 1.2.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,32 +1,44 @@
1
1
  /**
2
- * @license AngularJS v1.1.5
3
- * (c) 2010-2012 Google, Inc. http://angularjs.org
2
+ * @license AngularJS v1.3.0-beta.3
3
+ * (c) 2010-2014 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
6
- (function(window, angular, undefined) {
7
- 'use strict';
6
+ (function(window, angular, undefined) {'use strict';
8
7
 
9
8
  /**
10
- * @ngdoc overview
9
+ * @ngdoc module
11
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.
12
22
  */
13
23
 
14
24
 
15
25
  angular.module('ngCookies', ['ng']).
16
26
  /**
17
- * @ngdoc object
18
- * @name ngCookies.$cookies
19
- * @requires $browser
27
+ * @ngdoc service
28
+ * @name $cookies
20
29
  *
21
30
  * @description
22
31
  * Provides read/write access to browser's cookies.
23
32
  *
24
- * Only a simple Object is exposed and by adding or removing properties to/from
25
- * this object, new cookies are created/deleted at the end of current $eval.
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.
26
38
  *
27
39
  * @example
28
- <doc:example>
29
- <doc:source>
40
+ <example>
41
+ <file name="index.html">
30
42
  <script>
31
43
  function ExampleController($cookies) {
32
44
  // Retrieving a cookie
@@ -35,8 +47,8 @@ angular.module('ngCookies', ['ng']).
35
47
  $cookies.myFavorite = 'oatmeal';
36
48
  }
37
49
  </script>
38
- </doc:source>
39
- </doc:example>
50
+ </file>
51
+ </example>
40
52
  */
41
53
  factory('$cookies', ['$rootScope', '$browser', function ($rootScope, $browser) {
42
54
  var cookies = {},
@@ -68,7 +80,8 @@ angular.module('ngCookies', ['ng']).
68
80
 
69
81
 
70
82
  /**
71
- * Pushes all the cookies from the service to the browser and verifies if all cookies were stored.
83
+ * Pushes all the cookies from the service to the browser and verifies if all cookies were
84
+ * stored.
72
85
  */
73
86
  function push() {
74
87
  var name,
@@ -87,12 +100,10 @@ angular.module('ngCookies', ['ng']).
87
100
  for(name in cookies) {
88
101
  value = cookies[name];
89
102
  if (!angular.isString(value)) {
90
- if (angular.isDefined(lastCookies[name])) {
91
- cookies[name] = lastCookies[name];
92
- } else {
93
- delete cookies[name];
94
- }
95
- } else if (value !== lastCookies[name]) {
103
+ value = '' + value;
104
+ cookies[name] = value;
105
+ }
106
+ if (value !== lastCookies[name]) {
96
107
  $browser.cookies(name, value);
97
108
  updated = true;
98
109
  }
@@ -120,14 +131,17 @@ angular.module('ngCookies', ['ng']).
120
131
 
121
132
 
122
133
  /**
123
- * @ngdoc object
124
- * @name ngCookies.$cookieStore
134
+ * @ngdoc service
135
+ * @name $cookieStore
125
136
  * @requires $cookies
126
137
  *
127
138
  * @description
128
139
  * Provides a key-value (string-object) storage, that is backed by session cookies.
129
140
  * Objects put or retrieved from this storage are automatically serialized or
130
141
  * deserialized by angular's toJson/fromJson.
142
+ *
143
+ * Requires the {@link ngCookies `ngCookies`} module to be installed.
144
+ *
131
145
  * @example
132
146
  */
133
147
  factory('$cookieStore', ['$cookies', function($cookies) {
@@ -135,8 +149,7 @@ angular.module('ngCookies', ['ng']).
135
149
  return {
136
150
  /**
137
151
  * @ngdoc method
138
- * @name ngCookies.$cookieStore#get
139
- * @methodOf ngCookies.$cookieStore
152
+ * @name $cookieStore#get
140
153
  *
141
154
  * @description
142
155
  * Returns the value of given cookie key
@@ -151,8 +164,7 @@ angular.module('ngCookies', ['ng']).
151
164
 
152
165
  /**
153
166
  * @ngdoc method
154
- * @name ngCookies.$cookieStore#put
155
- * @methodOf ngCookies.$cookieStore
167
+ * @name $cookieStore#put
156
168
  *
157
169
  * @description
158
170
  * Sets a value for given cookie key
@@ -166,8 +178,7 @@ angular.module('ngCookies', ['ng']).
166
178
 
167
179
  /**
168
180
  * @ngdoc method
169
- * @name ngCookies.$cookieStore#remove
170
- * @methodOf ngCookies.$cookieStore
181
+ * @name $cookieStore#remove
171
182
  *
172
183
  * @description
173
184
  * Remove given cookie
@@ -1,14 +1,89 @@
1
1
  /**
2
- * @license AngularJS v1.1.5
3
- * (c) 2010-2012 Google, Inc. http://angularjs.org
2
+ * @license AngularJS v1.3.0-beta.3
3
+ * (c) 2010-2014 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
6
6
 
7
- (
7
+ (function() {'use strict';
8
8
 
9
9
  /**
10
- * @ngdoc interface
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.3.0-beta.3/' +
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
11
85
  * @name angular.Module
86
+ * @module ng
12
87
  * @description
13
88
  *
14
89
  * Interface for configuring angular {@link angular.module modules}.
@@ -16,30 +91,43 @@
16
91
 
17
92
  function setupModuleLoader(window) {
18
93
 
94
+ var $injectorMinErr = minErr('$injector');
95
+ var ngMinErr = minErr('ng');
96
+
19
97
  function ensure(obj, name, factory) {
20
98
  return obj[name] || (obj[name] = factory());
21
99
  }
22
100
 
23
- return ensure(ensure(window, 'angular', Object), 'module', function() {
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() {
24
107
  /** @type {Object.<string, angular.Module>} */
25
108
  var modules = {};
26
109
 
27
110
  /**
28
111
  * @ngdoc function
29
112
  * @name angular.module
113
+ * @module ng
30
114
  * @description
31
115
  *
32
- * The `angular.module` is a global place for creating and registering Angular modules. All
33
- * modules (angular core or 3rd party) that should be available to an application must be
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
34
119
  * registered using this mechanism.
35
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
+ *
36
124
  *
37
125
  * # Module
38
126
  *
39
- * A module is a collocation of services, directives, filters, and configuration information. Module
40
- * is used to configure the {@link AUTO.$injector $injector}.
127
+ * A module is a collection of services, directives, filters, and configuration information.
128
+ * `angular.module` is used to configure the {@link auto.$injector $injector}.
41
129
  *
42
- * <pre>
130
+ * ```js
43
131
  * // Create a new module
44
132
  * var myModule = angular.module('myModule', []);
45
133
  *
@@ -47,37 +135,45 @@ function setupModuleLoader(window) {
47
135
  * myModule.value('appName', 'MyCoolApp');
48
136
  *
49
137
  * // configure existing services inside initialization blocks.
50
- * myModule.config(function($locationProvider) {
51
- 'use strict';
138
+ * myModule.config(['$locationProvider', function($locationProvider) {
52
139
  * // Configure existing providers
53
140
  * $locationProvider.hashPrefix('!');
54
- * });
55
- * </pre>
141
+ * }]);
142
+ * ```
56
143
  *
57
144
  * Then you can create an injector and load your modules like this:
58
145
  *
59
- * <pre>
60
- * var injector = angular.injector(['ng', 'MyModule'])
61
- * </pre>
146
+ * ```js
147
+ * var injector = angular.injector(['ng', 'myModule'])
148
+ * ```
62
149
  *
63
150
  * However it's more likely that you'll just use
64
151
  * {@link ng.directive:ngApp ngApp} or
65
152
  * {@link angular.bootstrap} to simplify this process for you.
66
153
  *
67
154
  * @param {!string} name The name of the module to create or retrieve.
68
- * @param {Array.<string>=} requires If specified then new module is being created. If unspecified then the
69
- * the module is being retrieved for further configuration.
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.
70
157
  * @param {Function} configFn Optional configuration function for the module. Same as
71
158
  * {@link angular.Module#config Module#config()}.
72
159
  * @returns {module} new module with the {@link angular.Module} api.
73
160
  */
74
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');
75
169
  if (requires && modules.hasOwnProperty(name)) {
76
170
  modules[name] = null;
77
171
  }
78
172
  return ensure(modules, name, function() {
79
173
  if (!requires) {
80
- throw Error('No module: ' + name);
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);
81
177
  }
82
178
 
83
179
  /** @type {!Array.<Array.<*>>} */
@@ -97,17 +193,18 @@ function setupModuleLoader(window) {
97
193
  /**
98
194
  * @ngdoc property
99
195
  * @name angular.Module#requires
100
- * @propertyOf angular.Module
196
+ * @module ng
101
197
  * @returns {Array.<string>} List of module names which must be loaded before this module.
102
198
  * @description
103
- * Holds the list of modules which the injector will load before the current module is loaded.
199
+ * Holds the list of modules which the injector will load before the current module is
200
+ * loaded.
104
201
  */
105
202
  requires: requires,
106
203
 
107
204
  /**
108
205
  * @ngdoc property
109
206
  * @name angular.Module#name
110
- * @propertyOf angular.Module
207
+ * @module ng
111
208
  * @returns {string} Name of the module.
112
209
  * @description
113
210
  */
@@ -117,90 +214,98 @@ function setupModuleLoader(window) {
117
214
  /**
118
215
  * @ngdoc method
119
216
  * @name angular.Module#provider
120
- * @methodOf angular.Module
217
+ * @module ng
121
218
  * @param {string} name service name
122
- * @param {Function} providerType Construction function for creating new instance of the service.
219
+ * @param {Function} providerType Construction function for creating new instance of the
220
+ * service.
123
221
  * @description
124
- * See {@link AUTO.$provide#provider $provide.provider()}.
222
+ * See {@link auto.$provide#provider $provide.provider()}.
125
223
  */
126
224
  provider: invokeLater('$provide', 'provider'),
127
225
 
128
226
  /**
129
227
  * @ngdoc method
130
228
  * @name angular.Module#factory
131
- * @methodOf angular.Module
229
+ * @module ng
132
230
  * @param {string} name service name
133
231
  * @param {Function} providerFunction Function for creating new instance of the service.
134
232
  * @description
135
- * See {@link AUTO.$provide#factory $provide.factory()}.
233
+ * See {@link auto.$provide#factory $provide.factory()}.
136
234
  */
137
235
  factory: invokeLater('$provide', 'factory'),
138
236
 
139
237
  /**
140
238
  * @ngdoc method
141
239
  * @name angular.Module#service
142
- * @methodOf angular.Module
240
+ * @module ng
143
241
  * @param {string} name service name
144
242
  * @param {Function} constructor A constructor function that will be instantiated.
145
243
  * @description
146
- * See {@link AUTO.$provide#service $provide.service()}.
244
+ * See {@link auto.$provide#service $provide.service()}.
147
245
  */
148
246
  service: invokeLater('$provide', 'service'),
149
247
 
150
248
  /**
151
249
  * @ngdoc method
152
250
  * @name angular.Module#value
153
- * @methodOf angular.Module
251
+ * @module ng
154
252
  * @param {string} name service name
155
253
  * @param {*} object Service instance object.
156
254
  * @description
157
- * See {@link AUTO.$provide#value $provide.value()}.
255
+ * See {@link auto.$provide#value $provide.value()}.
158
256
  */
159
257
  value: invokeLater('$provide', 'value'),
160
258
 
161
259
  /**
162
260
  * @ngdoc method
163
261
  * @name angular.Module#constant
164
- * @methodOf angular.Module
262
+ * @module ng
165
263
  * @param {string} name constant name
166
264
  * @param {*} object Constant value.
167
265
  * @description
168
266
  * Because the constant are fixed, they get applied before other provide methods.
169
- * See {@link AUTO.$provide#constant $provide.constant()}.
267
+ * See {@link auto.$provide#constant $provide.constant()}.
170
268
  */
171
269
  constant: invokeLater('$provide', 'constant', 'unshift'),
172
270
 
173
271
  /**
174
272
  * @ngdoc method
175
273
  * @name angular.Module#animation
176
- * @methodOf angular.Module
274
+ * @module ng
177
275
  * @param {string} name animation name
178
- * @param {Function} animationFactory Factory function for creating new instance of an animation.
276
+ * @param {Function} animationFactory Factory function for creating new instance of an
277
+ * animation.
179
278
  * @description
180
279
  *
181
- * Defines an animation hook that can be later used with {@link ng.directive:ngAnimate ngAnimate}
182
- * alongside {@link ng.directive:ngAnimate#Description common ng directives} as well as custom directives.
183
- * <pre>
184
- * module.animation('animation-name', function($inject1, $inject2) {
185
- * return {
186
- * //this gets called in preparation to setup an animation
187
- * setup : function(element) { ... },
280
+ * **NOTE**: animations take effect only if the **ngAnimate** module is loaded.
281
+ *
188
282
  *
189
- * //this gets called once the animation is run
190
- * start : function(element, done, memo) { ... }
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
+ * }
191
296
  * }
192
297
  * })
193
- * </pre>
298
+ * ```
194
299
  *
195
- * See {@link ng.$animationProvider#register $animationProvider.register()} and
196
- * {@link ng.directive:ngAnimate ngAnimate} for more information.
300
+ * See {@link ngAnimate.$animateProvider#register $animateProvider.register()} and
301
+ * {@link ngAnimate ngAnimate module} for more information.
197
302
  */
198
- animation: invokeLater('$animationProvider', 'register'),
303
+ animation: invokeLater('$animateProvider', 'register'),
199
304
 
200
305
  /**
201
306
  * @ngdoc method
202
307
  * @name angular.Module#filter
203
- * @methodOf angular.Module
308
+ * @module ng
204
309
  * @param {string} name Filter name.
205
310
  * @param {Function} filterFactory Factory function for creating new instance of filter.
206
311
  * @description
@@ -211,8 +316,9 @@ function setupModuleLoader(window) {
211
316
  /**
212
317
  * @ngdoc method
213
318
  * @name angular.Module#controller
214
- * @methodOf angular.Module
215
- * @param {string} name Controller name.
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.
216
322
  * @param {Function} constructor Controller constructor function.
217
323
  * @description
218
324
  * See {@link ng.$controllerProvider#register $controllerProvider.register()}.
@@ -222,8 +328,9 @@ function setupModuleLoader(window) {
222
328
  /**
223
329
  * @ngdoc method
224
330
  * @name angular.Module#directive
225
- * @methodOf angular.Module
226
- * @param {string} name directive name
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.
227
334
  * @param {Function} directiveFactory Factory function for creating new instance of
228
335
  * directives.
229
336
  * @description
@@ -234,7 +341,7 @@ function setupModuleLoader(window) {
234
341
  /**
235
342
  * @ngdoc method
236
343
  * @name angular.Module#config
237
- * @methodOf angular.Module
344
+ * @module ng
238
345
  * @param {Function} configFn Execute this function on module load. Useful for service
239
346
  * configuration.
240
347
  * @description
@@ -245,7 +352,7 @@ function setupModuleLoader(window) {
245
352
  /**
246
353
  * @ngdoc method
247
354
  * @name angular.Module#run
248
- * @methodOf angular.Module
355
+ * @module ng
249
356
  * @param {Function} initializationFn Execute this function after injector creation.
250
357
  * Useful for application initialization.
251
358
  * @description
@@ -274,7 +381,7 @@ function setupModuleLoader(window) {
274
381
  return function() {
275
382
  invokeQueue[insertMethod || 'push']([provider, method, arguments]);
276
383
  return moduleInstance;
277
- }
384
+ };
278
385
  }
279
386
  });
280
387
  };
@@ -282,7 +389,8 @@ function setupModuleLoader(window) {
282
389
 
283
390
  }
284
391
 
285
- )(window);
392
+ setupModuleLoader(window);
393
+ })(window);
286
394
 
287
395
  /**
288
396
  * Closure compiler type information