rails-angularjs 1.3.12 → 1.3.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/rails-angularjs/version.rb +2 -2
  4. data/vendor/assets/javascripts/{angularjs/angular-animate.js → angular-animate.js} +1 -1
  5. data/vendor/assets/javascripts/{angularjs/angular-animate.min.js → angular-animate.min.js} +1 -1
  6. data/vendor/assets/javascripts/{angularjs/angular-aria.js → angular-aria.js} +16 -6
  7. data/vendor/assets/javascripts/angular-aria.min.js +12 -0
  8. data/vendor/assets/javascripts/{angularjs/angular-cookies.js → angular-cookies.js} +1 -1
  9. data/vendor/assets/javascripts/{angularjs/angular-cookies.min.js → angular-cookies.min.js} +1 -1
  10. data/vendor/assets/javascripts/{angularjs/angular-loader.js → angular-loader.js} +2 -2
  11. data/vendor/assets/javascripts/{angularjs/angular-loader.min.js → angular-loader.min.js} +2 -2
  12. data/vendor/assets/javascripts/{angularjs/angular-messages.js → angular-messages.js} +1 -1
  13. data/vendor/assets/javascripts/{angularjs/angular-messages.min.js → angular-messages.min.js} +1 -1
  14. data/vendor/assets/javascripts/{angularjs/angular-mocks.js → angular-mocks.js} +2 -2
  15. data/vendor/assets/javascripts/{angularjs/angular-resource.js → angular-resource.js} +2 -1
  16. data/vendor/assets/javascripts/{angularjs/angular-resource.min.js → angular-resource.min.js} +1 -1
  17. data/vendor/assets/javascripts/{angularjs/angular-route.js → angular-route.js} +1 -1
  18. data/vendor/assets/javascripts/{angularjs/angular-route.min.js → angular-route.min.js} +1 -1
  19. data/vendor/assets/javascripts/{angularjs/angular-sanitize.js → angular-sanitize.js} +7 -19
  20. data/vendor/assets/javascripts/angular-sanitize.min.js +16 -0
  21. data/vendor/assets/javascripts/{angularjs/angular-scenario.js → angular-scenario.js} +89 -38
  22. data/vendor/assets/javascripts/{angularjs/angular-touch.js → angular-touch.js} +1 -1
  23. data/vendor/assets/javascripts/{angularjs/angular-touch.min.js → angular-touch.min.js} +1 -1
  24. data/vendor/assets/javascripts/{angularjs/angular.js → angular.js} +89 -38
  25. data/vendor/assets/javascripts/angular.min.js +250 -0
  26. data/vendor/assets/javascripts/{angularjs/unstable → unstable}/angular-animate.js +1 -1
  27. data/vendor/assets/javascripts/{angularjs/unstable → unstable}/angular-animate.min.js +1 -1
  28. data/vendor/assets/javascripts/{angularjs/unstable → unstable}/angular-aria.js +16 -6
  29. data/vendor/assets/javascripts/unstable/angular-aria.min.js +12 -0
  30. data/vendor/assets/javascripts/{angularjs/unstable → unstable}/angular-cookies.js +1 -1
  31. data/vendor/assets/javascripts/{angularjs/unstable → unstable}/angular-cookies.min.js +1 -1
  32. data/vendor/assets/javascripts/{angularjs/unstable → unstable}/angular-loader.js +2 -2
  33. data/vendor/assets/javascripts/{angularjs/unstable → unstable}/angular-loader.min.js +2 -2
  34. data/vendor/assets/javascripts/unstable/angular-messages.js +644 -0
  35. data/vendor/assets/javascripts/unstable/angular-messages.min.js +12 -0
  36. data/vendor/assets/javascripts/{angularjs/unstable → unstable}/angular-mocks.js +2 -2
  37. data/vendor/assets/javascripts/{angularjs/unstable → unstable}/angular-resource.js +3 -2
  38. data/vendor/assets/javascripts/{angularjs/unstable → unstable}/angular-resource.min.js +1 -1
  39. data/vendor/assets/javascripts/{angularjs/unstable → unstable}/angular-route.js +1 -1
  40. data/vendor/assets/javascripts/{angularjs/unstable → unstable}/angular-route.min.js +1 -1
  41. data/vendor/assets/javascripts/{angularjs/unstable → unstable}/angular-sanitize.js +12 -22
  42. data/vendor/assets/javascripts/unstable/angular-sanitize.min.js +16 -0
  43. data/vendor/assets/javascripts/{angularjs/unstable → unstable}/angular-scenario.js +317 -155
  44. data/vendor/assets/javascripts/{angularjs/unstable → unstable}/angular-touch.js +1 -1
  45. data/vendor/assets/javascripts/{angularjs/unstable → unstable}/angular-touch.min.js +1 -1
  46. data/vendor/assets/javascripts/{angularjs/unstable → unstable}/angular.js +317 -155
  47. data/vendor/assets/javascripts/unstable/angular.min.js +282 -0
  48. metadata +46 -46
  49. data/vendor/assets/javascripts/angularjs/angular-aria.min.js +0 -12
  50. data/vendor/assets/javascripts/angularjs/angular-sanitize.min.js +0 -16
  51. data/vendor/assets/javascripts/angularjs/angular.min.js +0 -250
  52. data/vendor/assets/javascripts/angularjs/unstable/angular-aria.min.js +0 -12
  53. data/vendor/assets/javascripts/angularjs/unstable/angular-messages.js +0 -400
  54. data/vendor/assets/javascripts/angularjs/unstable/angular-messages.min.js +0 -10
  55. data/vendor/assets/javascripts/angularjs/unstable/angular-sanitize.min.js +0 -16
  56. data/vendor/assets/javascripts/angularjs/unstable/angular.min.js +0 -281
@@ -0,0 +1,644 @@
1
+ /**
2
+ * @license AngularJS v1.4.0-beta.5
3
+ * (c) 2010-2015 Google, Inc. http://angularjs.org
4
+ * License: MIT
5
+ */
6
+ (function(window, angular, undefined) {'use strict';
7
+
8
+ /* jshint ignore:start */
9
+ // this code is in the core, but not in angular-messages.js
10
+ var isArray = angular.isArray;
11
+ var forEach = angular.forEach;
12
+ var isString = angular.isString;
13
+ var jqLite = angular.element;
14
+ /* jshint ignore:end */
15
+
16
+ /**
17
+ * @ngdoc module
18
+ * @name ngMessages
19
+ * @description
20
+ *
21
+ * The `ngMessages` module provides enhanced support for displaying messages within templates
22
+ * (typically within forms or when rendering message objects that return key/value data).
23
+ * Instead of relying on JavaScript code and/or complex ng-if statements within your form template to
24
+ * show and hide error messages specific to the state of an input field, the `ngMessages` and
25
+ * `ngMessage` directives are designed to handle the complexity, inheritance and priority
26
+ * sequencing based on the order of how the messages are defined in the template.
27
+ *
28
+ * Currently, the ngMessages module only contains the code for the `ngMessages`, `ngMessagesInclude`
29
+ * `ngMessage` and `ngMessageExp` directives.
30
+ *
31
+ * # Usage
32
+ * The `ngMessages` directive listens on a key/value collection which is set on the ngMessages attribute.
33
+ * Since the {@link ngModel ngModel} directive exposes an `$error` object, this error object can be
34
+ * used with `ngMessages` to display control error messages in an easier way than with just regular angular
35
+ * template directives.
36
+ *
37
+ * ```html
38
+ * <form name="myForm">
39
+ * <input type="text" ng-model="field" name="myField" required minlength="5" />
40
+ * <div ng-messages="myForm.myField.$error">
41
+ * <div ng-message="required">You did not enter a field</div>
42
+ * <div ng-message="minlength, maxlength">
43
+ * Your email must be between 5 and 100 characters long
44
+ * </div>
45
+ * </div>
46
+ * </form>
47
+ * ```
48
+ *
49
+ * Now whatever key/value entries are present within the provided object (in this case `$error`) then
50
+ * the ngMessages directive will render the inner first ngMessage directive (depending if the key values
51
+ * match the attribute value present on each ngMessage directive). In other words, if your errors
52
+ * object contains the following data:
53
+ *
54
+ * ```javascript
55
+ * <!-- keep in mind that ngModel automatically sets these error flags -->
56
+ * myField.$error = { minlength : true, required : false };
57
+ * ```
58
+ *
59
+ * Then the `required` message will be displayed first. When required is false then the `minlength` message
60
+ * will be displayed right after (since these messages are ordered this way in the template HTML code).
61
+ * The prioritization of each message is determined by what order they're present in the DOM.
62
+ * Therefore, instead of having custom JavaScript code determine the priority of what errors are
63
+ * present before others, the presentation of the errors are handled within the template.
64
+ *
65
+ * By default, ngMessages will only display one error at a time. However, if you wish to display all
66
+ * messages then the `ng-messages-multiple` attribute flag can be used on the element containing the
67
+ * ngMessages directive to make this happen.
68
+ *
69
+ * ```html
70
+ * <!-- attribute-style usage -->
71
+ * <div ng-messages="myForm.myField.$error" ng-messages-multiple>...</div>
72
+ *
73
+ * <!-- element-style usage -->
74
+ * <ng-messages for="myForm.myField.$error" multiple>...</ng-messages>
75
+ * ```
76
+ *
77
+ * ## Reusing and Overriding Messages
78
+ * In addition to prioritization, ngMessages also allows for including messages from a remote or an inline
79
+ * template. This allows for generic collection of messages to be reused across multiple parts of an
80
+ * application.
81
+ *
82
+ * ```html
83
+ * <script type="text/ng-template" id="error-messages">
84
+ * <div ng-message="required">This field is required</div>
85
+ * <div ng-message="minlength">This field is too short</div>
86
+ * </script>
87
+ *
88
+ * <div ng-messages="myForm.myField.$error">
89
+ * <div ng-messages-include="error-messages"></div>
90
+ * </div>
91
+ * ```
92
+ *
93
+ * However, including generic messages may not be useful enough to match all input fields, therefore,
94
+ * `ngMessages` provides the ability to override messages defined in the remote template by redefining
95
+ * them within the directive container.
96
+ *
97
+ * ```html
98
+ * <!-- a generic template of error messages known as "my-custom-messages" -->
99
+ * <script type="text/ng-template" id="my-custom-messages">
100
+ * <div ng-message="required">This field is required</div>
101
+ * <div ng-message="minlength">This field is too short</div>
102
+ * </script>
103
+ *
104
+ * <form name="myForm">
105
+ * <input type="email"
106
+ * id="email"
107
+ * name="myEmail"
108
+ * ng-model="email"
109
+ * minlength="5"
110
+ * required />
111
+ *
112
+ * <!-- any ng-message elements that appear BEFORE the ng-messages-include will
113
+ * override the messages present in the ng-messages-include template -->
114
+ * <div ng-messages="myForm.myEmail.$error">
115
+ * <!-- this required message has overridden the template message -->
116
+ * <div ng-message="required">You did not enter your email address</div>
117
+ *
118
+ * <!-- this is a brand new message and will appear last in the prioritization -->
119
+ * <div ng-message="email">Your email address is invalid</div>
120
+ *
121
+ * <!-- and here are the generic error messages -->
122
+ * <div ng-messages-include="error-messages"></div>
123
+ * </div>
124
+ * </form>
125
+ * ```
126
+ *
127
+ * In the example HTML code above the message that is set on required will override the corresponding
128
+ * required message defined within the remote template. Therefore, with particular input fields (such
129
+ * email addresses, date fields, autocomplete inputs, etc...), specialized error messages can be applied
130
+ * while more generic messages can be used to handle other, more general input errors.
131
+ *
132
+ * ## Dynamic Messaging
133
+ * ngMessages also supports using expressions to dynamically change key values. Using arrays and
134
+ * repeaters to list messages is also supported. This means that the code below will be able to
135
+ * fully adapt itself and display the appropriate message when any of the expression data changes:
136
+ *
137
+ * ```html
138
+ * <form name="myForm">
139
+ * <input type="email"
140
+ * name="myEmail"
141
+ * ng-model="email"
142
+ * minlength="5"
143
+ * required />
144
+ *
145
+ * <div ng-messages="myForm.myEmail.$error">
146
+ * <div ng-message="required">You did not enter your email address</div>
147
+ * <div ng-repeat="errorMessage in errorMessages">
148
+ * <!-- use ng-message-exp for a message whose key is given by an expression -->
149
+ * <div ng-message-exp="errorMessage.type">{{ errorMessage.text }}</div>
150
+ * </div>
151
+ * </div>
152
+ * </form>
153
+ * ```
154
+ *
155
+ * The `errorMessage.type` expression can be a string value or it can be an array so
156
+ * that multiple errors can be associated with a single error message:
157
+ *
158
+ * ```html
159
+ * <input type="email"
160
+ * ng-model="data.email"
161
+ * name="myEmail"
162
+ * ng-minlength="5"
163
+ * ng-maxlength="100"
164
+ * required />
165
+ * <div ng-messages="myForm.myEmail.$error">
166
+ * <div ng-message-exp="'required'">You did not enter your email address</div>
167
+ * <div ng-message-exp="['minlength', 'maxlength]">
168
+ * Your email must be between 5 and 100 characters long
169
+ * </div>
170
+ * </div>
171
+ * ```
172
+ *
173
+ * Feel free to use other structural directives such as ng-if and ng-switch to further control
174
+ * what messages are active and when. Be careful, if you place ng-message on the same element
175
+ * as these structural directives, Angular may not be able to determine if a message is active
176
+ * or not. Therefore it is best to place the ng-message on a child element of the structural
177
+ * directive.
178
+ *
179
+ * ```html
180
+ * <div ng-messages="myForm.myEmail.$error">
181
+ * <div ng-if="showRequiredError">
182
+ * <div ng-message="required">Please enter something</div>
183
+ * </div>
184
+ * </div>
185
+ * ```
186
+ *
187
+ * ## Animations
188
+ * If the `ngAnimate` module is active within the application then the `ngMessages`, `ngMessage` and
189
+ * `ngMessageExp` directives will trigger animations whenever any messages are added and removed from
190
+ * the DOM by the `ngMessages` directive.
191
+ *
192
+ * Whenever the `ngMessages` directive contains one or more visible messages then the `.ng-active` CSS
193
+ * class will be added to the element. The `.ng-inactive` CSS class will be applied when there are no
194
+ * messages present. Therefore, CSS transitions and keyframes as well as JavaScript animations can
195
+ * hook into the animations whenever these classes are added/removed.
196
+ *
197
+ * Let's say that our HTML code for our messages container looks like so:
198
+ *
199
+ * ```html
200
+ * <div ng-messages="myMessages" class="my-messages">
201
+ * <div ng-message="alert" class="some-message">...</div>
202
+ * <div ng-message="fail" class="some-message">...</div>
203
+ * </div>
204
+ * ```
205
+ *
206
+ * Then the CSS animation code for the message container looks like so:
207
+ *
208
+ * ```css
209
+ * .my-messages {
210
+ * transition:1s linear all;
211
+ * }
212
+ * .my-messages.ng-active {
213
+ * // messages are visible
214
+ * }
215
+ * .my-messages.ng-inactive {
216
+ * // messages are hidden
217
+ * }
218
+ * ```
219
+ *
220
+ * Whenever an inner message is attached (becomes visible) or removed (becomes hidden) then the enter
221
+ * and leave animation is triggered for each particular element bound to the `ngMessage` directive.
222
+ *
223
+ * Therefore, the CSS code for the inner messages looks like so:
224
+ *
225
+ * ```css
226
+ * .some-message {
227
+ * transition:1s linear all;
228
+ * }
229
+ *
230
+ * .some-message.ng-enter {}
231
+ * .some-message.ng-enter.ng-enter-active {}
232
+ *
233
+ * .some-message.ng-leave {}
234
+ * .some-message.ng-leave.ng-leave-active {}
235
+ * ```
236
+ *
237
+ * {@link ngAnimate Click here} to learn how to use JavaScript animations or to learn more about ngAnimate.
238
+ */
239
+ angular.module('ngMessages', [])
240
+
241
+ /**
242
+ * @ngdoc directive
243
+ * @module ngMessages
244
+ * @name ngMessages
245
+ * @restrict AE
246
+ *
247
+ * @description
248
+ * `ngMessages` is a directive that is designed to show and hide messages based on the state
249
+ * of a key/value object that it listens on. The directive itself compliments error message
250
+ * reporting with the `ngModel` $error object (which stores a key/value state of validation errors).
251
+ *
252
+ * `ngMessages` manages the state of internal messages within its container element. The internal
253
+ * messages use the `ngMessage` directive and will be inserted/removed from the page depending
254
+ * on if they're present within the key/value object. By default, only one message will be displayed
255
+ * at a time and this depends on the prioritization of the messages within the template. (This can
256
+ * be changed by using the `ng-messages-multiple` or `multiple` attribute on the directive container.)
257
+ *
258
+ * A remote template can also be used to promote message reusability and messages can also be
259
+ * overridden.
260
+ *
261
+ * {@link module:ngMessages Click here} to learn more about `ngMessages` and `ngMessage`.
262
+ *
263
+ * @usage
264
+ * ```html
265
+ * <!-- using attribute directives -->
266
+ * <ANY ng-messages="expression">
267
+ * <ANY ng-message="stringValue">...</ANY>
268
+ * <ANY ng-message="stringValue1, stringValue2, ...">...</ANY>
269
+ * <ANY ng-message-exp="expressionValue">...</ANY>
270
+ * </ANY>
271
+ *
272
+ * <!-- or by using element directives -->
273
+ * <ng-messages for="expression">
274
+ * <ng-message when="stringValue">...</ng-message>
275
+ * <ng-message when="stringValue1, stringValue2, ...">...</ng-message>
276
+ * <ng-message when-exp="expressionValue">...</ng-message>
277
+ * </ng-messages>
278
+ * ```
279
+ *
280
+ * @param {string} ngMessages an angular expression evaluating to a key/value object
281
+ * (this is typically the $error object on an ngModel instance).
282
+ * @param {string=} ngMessagesMultiple|multiple when set, all messages will be displayed with true
283
+ *
284
+ * @example
285
+ * <example name="ngMessages-directive" module="ngMessagesExample"
286
+ * deps="angular-messages.js"
287
+ * animations="true" fixBase="true">
288
+ * <file name="index.html">
289
+ * <form name="myForm">
290
+ * <label>Enter your name:</label>
291
+ * <input type="text"
292
+ * name="myName"
293
+ * ng-model="name"
294
+ * ng-minlength="5"
295
+ * ng-maxlength="20"
296
+ * required />
297
+ *
298
+ * <pre>myForm.myName.$error = {{ myForm.myName.$error | json }}</pre>
299
+ *
300
+ * <div ng-messages="myForm.myName.$error" style="color:maroon">
301
+ * <div ng-message="required">You did not enter a field</div>
302
+ * <div ng-message="minlength">Your field is too short</div>
303
+ * <div ng-message="maxlength">Your field is too long</div>
304
+ * </div>
305
+ * </form>
306
+ * </file>
307
+ * <file name="script.js">
308
+ * angular.module('ngMessagesExample', ['ngMessages']);
309
+ * </file>
310
+ * </example>
311
+ */
312
+ .directive('ngMessages', ['$animate', function($animate) {
313
+ var ACTIVE_CLASS = 'ng-active';
314
+ var INACTIVE_CLASS = 'ng-inactive';
315
+
316
+ return {
317
+ require: 'ngMessages',
318
+ restrict: 'AE',
319
+ controller: ['$element', '$scope', '$attrs', function($element, $scope, $attrs) {
320
+ var ctrl = this;
321
+ var latestKey = 0;
322
+
323
+ var messages = this.messages = {};
324
+ var renderLater, cachedCollection;
325
+
326
+ this.render = function(collection) {
327
+ collection = collection || {};
328
+
329
+ renderLater = false;
330
+ cachedCollection = collection;
331
+
332
+ // this is true if the attribute is empty or if the attribute value is truthy
333
+ var multiple = isAttrTruthy($scope, $attrs.ngMessagesMultiple) ||
334
+ isAttrTruthy($scope, $attrs.multiple);
335
+
336
+ var unmatchedMessages = [];
337
+ var matchedKeys = {};
338
+ var messageItem = ctrl.head;
339
+ var messageFound = false;
340
+ var totalMessages = 0;
341
+
342
+ // we use != instead of !== to allow for both undefined and null values
343
+ while (messageItem != null) {
344
+ totalMessages++;
345
+ var messageCtrl = messageItem.message;
346
+
347
+ var messageUsed = false;
348
+ if (!messageFound) {
349
+ forEach(collection, function(value, key) {
350
+ if (!messageUsed && truthy(value) && messageCtrl.test(key)) {
351
+ // this is to prevent the same error name from showing up twice
352
+ if (matchedKeys[key]) return;
353
+ matchedKeys[key] = true;
354
+
355
+ messageUsed = true;
356
+ messageCtrl.attach();
357
+ }
358
+ });
359
+ }
360
+
361
+ if (messageUsed) {
362
+ // unless we want to display multiple messages then we should
363
+ // set a flag here to avoid displaying the next message in the list
364
+ messageFound = !multiple;
365
+ } else {
366
+ unmatchedMessages.push(messageCtrl);
367
+ }
368
+
369
+ messageItem = messageItem.next;
370
+ }
371
+
372
+ forEach(unmatchedMessages, function(messageCtrl) {
373
+ messageCtrl.detach();
374
+ });
375
+
376
+ unmatchedMessages.length !== totalMessages
377
+ ? $animate.setClass($element, ACTIVE_CLASS, INACTIVE_CLASS)
378
+ : $animate.setClass($element, INACTIVE_CLASS, ACTIVE_CLASS);
379
+ };
380
+
381
+ $scope.$watchCollection($attrs.ngMessages || $attrs['for'], ctrl.render);
382
+
383
+ this.reRender = function() {
384
+ if (!renderLater) {
385
+ renderLater = true;
386
+ $scope.$evalAsync(function() {
387
+ if (renderLater) {
388
+ cachedCollection && ctrl.render(cachedCollection);
389
+ }
390
+ });
391
+ }
392
+ };
393
+
394
+ this.register = function(comment, messageCtrl) {
395
+ var nextKey = latestKey.toString();
396
+ messages[nextKey] = {
397
+ message: messageCtrl
398
+ };
399
+ insertMessageNode($element[0], comment, nextKey);
400
+ comment.$$ngMessageNode = nextKey;
401
+ latestKey++;
402
+
403
+ ctrl.reRender();
404
+ };
405
+
406
+ this.deregister = function(comment) {
407
+ var key = comment.$$ngMessageNode;
408
+ delete comment.$$ngMessageNode;
409
+ removeMessageNode($element[0], comment, key);
410
+ delete messages[key];
411
+ ctrl.reRender();
412
+ };
413
+
414
+ function findPreviousMessage(parent, comment) {
415
+ var prevNode = comment;
416
+ var parentLookup = [];
417
+ while (prevNode && prevNode !== parent) {
418
+ var prevKey = prevNode.$$ngMessageNode;
419
+ if (prevKey && prevKey.length) {
420
+ return messages[prevKey];
421
+ }
422
+
423
+ // dive deeper into the DOM and examine its children for any ngMessage
424
+ // comments that may be in an element that appears deeper in the list
425
+ if (prevNode.childNodes.length && parentLookup.indexOf(prevNode) == -1) {
426
+ parentLookup.push(prevNode);
427
+ prevNode = prevNode.childNodes[prevNode.childNodes.length - 1];
428
+ } else {
429
+ prevNode = prevNode.previousSibling || prevNode.parentNode;
430
+ }
431
+ }
432
+ }
433
+
434
+ function insertMessageNode(parent, comment, key) {
435
+ var messageNode = messages[key];
436
+ if (!ctrl.head) {
437
+ ctrl.head = messageNode;
438
+ } else {
439
+ var match = findPreviousMessage(parent, comment);
440
+ if (match) {
441
+ messageNode.next = match.next;
442
+ match.next = messageNode;
443
+ } else {
444
+ messageNode.next = ctrl.head;
445
+ ctrl.head = messageNode;
446
+ }
447
+ }
448
+ }
449
+
450
+ function removeMessageNode(parent, comment, key) {
451
+ var messageNode = messages[key];
452
+
453
+ var match = findPreviousMessage(parent, comment);
454
+ if (match) {
455
+ match.next = messageNode.next;
456
+ } else {
457
+ ctrl.head = messageNode.next;
458
+ }
459
+ }
460
+ }]
461
+ };
462
+
463
+ function isAttrTruthy(scope, attr) {
464
+ return (isString(attr) && attr.length === 0) || //empty attribute
465
+ truthy(scope.$eval(attr));
466
+ }
467
+
468
+ function truthy(val) {
469
+ return isString(val) ? val.length : !!val;
470
+ }
471
+ }])
472
+
473
+ /**
474
+ * @ngdoc directive
475
+ * @name ngMessagesInclude
476
+ * @restrict AE
477
+ * @scope
478
+ *
479
+ * @description
480
+ * `ngMessagesInclude` is a directive with the purpose to import existing ngMessage template
481
+ * code from a remote template and place the downloaded template code into the exact spot
482
+ * that the ngMessagesInclude directive is placed within the ngMessages container. This allows
483
+ * for a series of pre-defined messages to be reused and also allows for the developer to
484
+ * determine what messages are overridden due to the placement of the ngMessagesInclude directive.
485
+ *
486
+ * @usage
487
+ * ```html
488
+ * <!-- using attribute directives -->
489
+ * <ANY ng-messages="expression">
490
+ * <ANY ng-messages-include="remoteTplString">...</ANY>
491
+ * </ANY>
492
+ *
493
+ * <!-- or by using element directives -->
494
+ * <ng-messages for="expression">
495
+ * <ng-messages-include src="expressionValue1">...</ng-messages-include>
496
+ * </ng-messages>
497
+ * ```
498
+ *
499
+ * {@link module:ngMessages Click here} to learn more about `ngMessages` and `ngMessage`.
500
+ *
501
+ * @param {string} ngMessagesInclude|src a string value corresponding to the remote template.
502
+ */
503
+ .directive('ngMessagesInclude',
504
+ ['$templateRequest', '$document', '$compile', function($templateRequest, $document, $compile) {
505
+
506
+ return {
507
+ restrict: 'AE',
508
+ require: '^^ngMessages',
509
+ compile: function(element, attrs) {
510
+ var comment = jqLite($document[0].createComment(' ngMessagesInclude: '));
511
+ element.after(comment);
512
+
513
+ return function($scope, $element, attrs, ngMessagesCtrl) {
514
+ // we're removing this since we only need access to the newly
515
+ // created comment node as an anchor.
516
+ element.remove();
517
+
518
+ $templateRequest(attrs.ngMessagesInclude || attrs.src).then(function(html) {
519
+ var elements = jqLite('<div></div>').html(html).contents();
520
+ var cursor = comment;
521
+ forEach(elements, function(elm) {
522
+ elm = jqLite(elm);
523
+ cursor.after(elm);
524
+ cursor = elm;
525
+ });
526
+ $compile(elements)($scope);
527
+ });
528
+ };
529
+ }
530
+ };
531
+ }])
532
+
533
+ /**
534
+ * @ngdoc directive
535
+ * @name ngMessage
536
+ * @restrict AE
537
+ * @scope
538
+ *
539
+ * @description
540
+ * `ngMessage` is a directive with the purpose to show and hide a particular message.
541
+ * For `ngMessage` to operate, a parent `ngMessages` directive on a parent DOM element
542
+ * must be situated since it determines which messages are visible based on the state
543
+ * of the provided key/value map that `ngMessages` listens on.
544
+ *
545
+ * @usage
546
+ * ```html
547
+ * <!-- using attribute directives -->
548
+ * <ANY ng-messages="expression">
549
+ * <ANY ng-message="stringValue">...</ANY>
550
+ * <ANY ng-message="stringValue1, stringValue2, ...">...</ANY>
551
+ * <ANY ng-message-exp="expressionValue">...</ANY>
552
+ * </ANY>
553
+ *
554
+ * <!-- or by using element directives -->
555
+ * <ng-messages for="expression">
556
+ * <ng-message when="stringValue">...</ng-message>
557
+ * <ng-message when="stringValue1, stringValue2, ...">...</ng-message>
558
+ * <ng-message when-exp="expressionValue">...</ng-message>
559
+ * </ng-messages>
560
+ * ```
561
+ *
562
+ * {@link module:ngMessages Click here} to learn more about `ngMessages` and `ngMessage`.
563
+ *
564
+ * @param {expression} ngMessage|when a string value corresponding to the message key.
565
+ * @param {expression} ngMessageExp|whenExp an expression value corresponding to the message key.
566
+ */
567
+ .directive('ngMessage', ngMessageDirectiveFactory('AE'))
568
+ .directive('ngMessageExp', ngMessageDirectiveFactory('A'));
569
+
570
+ function ngMessageDirectiveFactory(restrict) {
571
+ return ['$animate', function($animate) {
572
+ return {
573
+ restrict: 'AE',
574
+ transclude: 'element',
575
+ terminal: true,
576
+ require: '^^ngMessages',
577
+ link: function(scope, element, attrs, ngMessagesCtrl, $transclude) {
578
+ var commentNode = element[0];
579
+
580
+ var records;
581
+ var staticExp = attrs.ngMessage || attrs.when;
582
+ var dynamicExp = attrs.ngMessageExp || attrs.whenExp;
583
+ var assignRecords = function(items) {
584
+ records = items
585
+ ? (isArray(items)
586
+ ? items
587
+ : items.split(/[\s,]+/))
588
+ : null;
589
+ ngMessagesCtrl.reRender();
590
+ };
591
+
592
+ if (dynamicExp) {
593
+ assignRecords(scope.$eval(dynamicExp));
594
+ scope.$watchCollection(dynamicExp, assignRecords);
595
+ } else {
596
+ assignRecords(staticExp);
597
+ }
598
+
599
+ var currentElement, messageCtrl;
600
+ ngMessagesCtrl.register(commentNode, messageCtrl = {
601
+ test: function(name) {
602
+ return contains(records, name);
603
+ },
604
+ attach: function() {
605
+ if (!currentElement) {
606
+ $transclude(scope, function(elm) {
607
+ $animate.enter(elm, null, element);
608
+ currentElement = elm;
609
+
610
+ // in the event that the parent element is destroyed
611
+ // by any other structural directive then it's time
612
+ // to deregister the message from the controller
613
+ currentElement.on('$destroy', function() {
614
+ if (currentElement) {
615
+ ngMessagesCtrl.deregister(commentNode);
616
+ messageCtrl.detach();
617
+ }
618
+ });
619
+ });
620
+ }
621
+ },
622
+ detach: function() {
623
+ if (currentElement) {
624
+ var elm = currentElement;
625
+ currentElement = null;
626
+ $animate.leave(elm);
627
+ }
628
+ }
629
+ });
630
+ }
631
+ };
632
+ }];
633
+
634
+ function contains(collection, key) {
635
+ if (collection) {
636
+ return isArray(collection)
637
+ ? collection.indexOf(key) >= 0
638
+ : collection.hasOwnProperty(key);
639
+ }
640
+ }
641
+ }
642
+
643
+
644
+ })(window, window.angular);
@@ -0,0 +1,12 @@
1
+ /*
2
+ AngularJS v1.4.0-beta.5
3
+ (c) 2010-2015 Google, Inc. http://angularjs.org
4
+ License: MIT
5
+ */
6
+ (function(z,h,A){'use strict';function w(h){return["$animate",function(p){return{restrict:"AE",transclude:"element",terminal:!0,require:"^^ngMessages",link:function(n,d,c,k,h){var f=d[0],m,l=c.ngMessage||c.when;c=c.ngMessageExp||c.whenExp;var g=function(a){m=a?x(a)?a:a.split(/[\s,]+/):null;k.reRender()};c?(g(n.$eval(c)),n.$watchCollection(c,g)):g(l);var e,a;k.register(f,a={test:function(a){var b=m;a=b?x(b)?0<=b.indexOf(a):b.hasOwnProperty(a):void 0;return a},attach:function(){e||h(n,function(c){p.enter(c,
7
+ null,d);e=c;e.on("$destroy",function(){e&&(k.deregister(f),a.detach())})})},detach:function(){if(e){var a=e;e=null;p.leave(a)}}})}}}]}var x=h.isArray,t=h.forEach,y=h.isString,q=h.element;h.module("ngMessages",[]).directive("ngMessages",["$animate",function(h){function p(d,c){return y(c)&&0===c.length||n(d.$eval(c))}function n(d){return y(d)?d.length:!!d}return{require:"ngMessages",restrict:"AE",controller:["$element","$scope","$attrs",function(d,c,k){function r(a,c){for(var b=c,d=[];b&&b!==a;){var f=
8
+ b.$$ngMessageNode;if(f&&f.length)return l[f];b.childNodes.length&&-1==d.indexOf(b)?(d.push(b),b=b.childNodes[b.childNodes.length-1]):b=b.previousSibling||b.parentNode}}var f=this,m=0,l=this.messages={},g,e;this.render=function(a){a=a||{};g=!1;e=a;for(var m=p(c,k.ngMessagesMultiple)||p(c,k.multiple),b=[],l={},s=f.head,r=!1,q=0;null!=s;){q++;var u=s.message,v=!1;r||t(a,function(a,b){!v&&n(a)&&u.test(b)&&!l[b]&&(v=l[b]=!0,u.attach())});v?r=!m:b.push(u);s=s.next}t(b,function(a){a.detach()});b.length!==
9
+ q?h.setClass(d,"ng-active","ng-inactive"):h.setClass(d,"ng-inactive","ng-active")};c.$watchCollection(k.ngMessages||k["for"],f.render);this.reRender=function(){g||(g=!0,c.$evalAsync(function(){g&&e&&f.render(e)}))};this.register=function(a,c){var b=m.toString();l[b]={message:c};var e=d[0],g=l[b];f.head?(e=r(e,a))?(g.next=e.next,e.next=g):(g.next=f.head,f.head=g):f.head=g;a.$$ngMessageNode=b;m++;f.reRender()};this.deregister=function(a){var c=a.$$ngMessageNode;delete a.$$ngMessageNode;var b=l[c];(a=
10
+ r(d[0],a))?a.next=b.next:f.head=b.next;delete l[c];f.reRender()}}]}}]).directive("ngMessagesInclude",["$templateRequest","$document","$compile",function(h,p,n){return{restrict:"AE",require:"^^ngMessages",compile:function(d,c){var k=q(p[0].createComment(" ngMessagesInclude: "));d.after(k);return function(c,f,m,l){d.remove();h(m.ngMessagesInclude||m.src).then(function(d){d=q("<div></div>").html(d).contents();var e=k;t(d,function(a){a=q(a);e.after(a);e=a});n(d)(c)})}}}}]).directive("ngMessage",w("AE")).directive("ngMessageExp",
11
+ w("A"))})(window,window.angular);
12
+ //# sourceMappingURL=angular-messages.min.js.map
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.4.0-beta.3
2
+ * @license AngularJS v1.4.0-beta.5
3
3
  * (c) 2010-2015 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -2138,7 +2138,7 @@ angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) {
2138
2138
  if (window.jasmine || window.mocha) {
2139
2139
 
2140
2140
  var currentSpec = null,
2141
- annotatedFunctions,
2141
+ annotatedFunctions = [],
2142
2142
  isSpecRunning = function() {
2143
2143
  return !!currentSpec;
2144
2144
  };