angularjs-rails 1.5.8 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +6 -1
- data/lib/angularjs-rails/engine.rb +1 -1
- data/lib/angularjs-rails/version.rb +1 -1
- data/vendor/assets/javascripts/angular-animate.js +426 -293
- data/vendor/assets/javascripts/angular-aria.js +64 -43
- data/vendor/assets/javascripts/angular-cookies.js +24 -93
- data/vendor/assets/javascripts/angular-loader.js +190 -36
- data/vendor/assets/javascripts/angular-message-format.js +72 -84
- data/vendor/assets/javascripts/angular-messages.js +158 -68
- data/vendor/assets/javascripts/angular-mocks.js +1033 -402
- data/vendor/assets/javascripts/angular-parse-ext.js +14 -10
- data/vendor/assets/javascripts/angular-resource.js +317 -269
- data/vendor/assets/javascripts/angular-route.js +329 -132
- data/vendor/assets/javascripts/angular-sanitize.js +268 -93
- data/vendor/assets/javascripts/angular-touch.js +46 -413
- data/vendor/assets/javascripts/angular.js +9213 -4485
- metadata +2 -3
- data/vendor/assets/javascripts/angular-scenario.js +0 -44134
@@ -1,6 +1,6 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.
|
3
|
-
* (c) 2010-
|
2
|
+
* @license AngularJS v1.8.0
|
3
|
+
* (c) 2010-2020 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
6
6
|
(function(window, angular) {'use strict';
|
@@ -13,22 +13,14 @@
|
|
13
13
|
/* global isFunction: false */
|
14
14
|
/* global noop: false */
|
15
15
|
/* global toJson: false */
|
16
|
-
|
17
|
-
function stringify(value) {
|
18
|
-
if (value == null /* null/undefined */) { return ''; }
|
19
|
-
switch (typeof value) {
|
20
|
-
case 'string': return value;
|
21
|
-
case 'number': return '' + value;
|
22
|
-
default: return toJson(value);
|
23
|
-
}
|
24
|
-
}
|
16
|
+
/* global $$stringify: false */
|
25
17
|
|
26
18
|
// Convert an index into the string into line/column for use in error messages
|
27
19
|
// As such, this doesn't have to be efficient.
|
28
20
|
function indexToLineAndColumn(text, index) {
|
29
21
|
var lines = text.split(/\n/g);
|
30
|
-
for (var i=0; i < lines.length; i++) {
|
31
|
-
var line=lines[i];
|
22
|
+
for (var i = 0; i < lines.length; i++) {
|
23
|
+
var line = lines[i];
|
32
24
|
if (index >= line.length) {
|
33
25
|
index -= line.length;
|
34
26
|
} else {
|
@@ -47,7 +39,7 @@ function parseTextLiteral(text) {
|
|
47
39
|
parsedFn['$$watchDelegate'] = function watchDelegate(scope, listener, objectEquality) {
|
48
40
|
var unwatch = scope['$watch'](noop,
|
49
41
|
function textLiteralWatcher() {
|
50
|
-
|
42
|
+
listener(text, text, scope);
|
51
43
|
unwatch();
|
52
44
|
},
|
53
45
|
objectEquality);
|
@@ -64,14 +56,14 @@ function subtractOffset(expressionFn, offset) {
|
|
64
56
|
return expressionFn;
|
65
57
|
}
|
66
58
|
function minusOffset(value) {
|
67
|
-
return (value ==
|
59
|
+
return (value == null) ? value : value - offset;
|
68
60
|
}
|
69
61
|
function parsedFn(context) { return minusOffset(expressionFn(context)); }
|
70
62
|
var unwatch;
|
71
63
|
parsedFn['$$watchDelegate'] = function watchDelegate(scope, listener, objectEquality) {
|
72
64
|
unwatch = scope['$watch'](expressionFn,
|
73
65
|
function pluralExpressionWatchListener(newValue, oldValue) {
|
74
|
-
|
66
|
+
listener(minusOffset(newValue), minusOffset(oldValue), scope);
|
75
67
|
},
|
76
68
|
objectEquality);
|
77
69
|
return unwatch;
|
@@ -96,7 +88,7 @@ function MessageSelectorBase(expressionFn, choices) {
|
|
96
88
|
var self = this;
|
97
89
|
this.expressionFn = expressionFn;
|
98
90
|
this.choices = choices;
|
99
|
-
if (choices[
|
91
|
+
if (choices['other'] === undefined) {
|
100
92
|
throw $interpolateMinErr('reqother', '“other” is a required option.');
|
101
93
|
}
|
102
94
|
this.parsedFn = function(context) { return self.getResult(context); };
|
@@ -130,7 +122,7 @@ function MessageSelectorWatchers(msgSelector, scope, listener, objectEquality) {
|
|
130
122
|
this.msgSelector = msgSelector;
|
131
123
|
this.listener = listener;
|
132
124
|
this.objectEquality = objectEquality;
|
133
|
-
this.lastMessage =
|
125
|
+
this.lastMessage = undefined;
|
134
126
|
this.messageFnWatcher = noop;
|
135
127
|
var expressionFnListener = function(newValue, oldValue) { return self.expressionFnListener(newValue, oldValue); };
|
136
128
|
this.expressionFnWatcher = scope['$watch'](msgSelector.expressionFn, expressionFnListener, objectEquality);
|
@@ -145,9 +137,7 @@ MessageSelectorWatchers.prototype.expressionFnListener = function expressionFnLi
|
|
145
137
|
};
|
146
138
|
|
147
139
|
MessageSelectorWatchers.prototype.messageFnListener = function messageFnListener(newMessage, oldMessage) {
|
148
|
-
|
149
|
-
this.listener.call(null, newMessage, newMessage === oldMessage ? newMessage : this.lastMessage, this.scope);
|
150
|
-
}
|
140
|
+
this.listener.call(null, newMessage, newMessage === oldMessage ? newMessage : this.lastMessage, this.scope);
|
151
141
|
this.lastMessage = newMessage;
|
152
142
|
};
|
153
143
|
|
@@ -170,7 +160,7 @@ SelectMessageProto.prototype = MessageSelectorBase.prototype;
|
|
170
160
|
|
171
161
|
SelectMessage.prototype = new SelectMessageProto();
|
172
162
|
SelectMessage.prototype.categorizeValue = function categorizeSelectValue(value) {
|
173
|
-
return (this.choices[value] !==
|
163
|
+
return (this.choices[value] !== undefined) ? value : 'other';
|
174
164
|
};
|
175
165
|
|
176
166
|
/**
|
@@ -190,12 +180,12 @@ PluralMessageProto.prototype = MessageSelectorBase.prototype;
|
|
190
180
|
PluralMessage.prototype = new PluralMessageProto();
|
191
181
|
PluralMessage.prototype.categorizeValue = function categorizePluralValue(value) {
|
192
182
|
if (isNaN(value)) {
|
193
|
-
return
|
194
|
-
} else if (this.choices[value] !==
|
183
|
+
return 'other';
|
184
|
+
} else if (this.choices[value] !== undefined) {
|
195
185
|
return value;
|
196
186
|
} else {
|
197
187
|
var category = this.pluralCat(value - this.offset);
|
198
|
-
return (this.choices[category] !==
|
188
|
+
return (this.choices[category] !== undefined) ? category : 'other';
|
199
189
|
}
|
200
190
|
};
|
201
191
|
|
@@ -264,7 +254,7 @@ InterpolationParts.prototype.getExpressionValues = function getExpressionValues(
|
|
264
254
|
InterpolationParts.prototype.getResult = function getResult(expressionValues) {
|
265
255
|
for (var i = 0; i < this.expressionIndices.length; i++) {
|
266
256
|
var expressionValue = expressionValues[i];
|
267
|
-
if (this.allOrNothing && expressionValue ===
|
257
|
+
if (this.allOrNothing && expressionValue === undefined) return;
|
268
258
|
this.textParts[this.expressionIndices[i]] = expressionValue;
|
269
259
|
}
|
270
260
|
return this.textParts.join('');
|
@@ -275,7 +265,7 @@ InterpolationParts.prototype.toParsedFn = function toParsedFn(mustHaveExpression
|
|
275
265
|
var self = this;
|
276
266
|
this.flushPartialText();
|
277
267
|
if (mustHaveExpression && this.expressionFns.length === 0) {
|
278
|
-
return
|
268
|
+
return undefined;
|
279
269
|
}
|
280
270
|
if (this.textParts.length === 0) {
|
281
271
|
return parseTextLiteral('');
|
@@ -284,7 +274,7 @@ InterpolationParts.prototype.toParsedFn = function toParsedFn(mustHaveExpression
|
|
284
274
|
$interpolateMinErr['throwNoconcat'](originalText);
|
285
275
|
}
|
286
276
|
if (this.expressionFns.length === 0) {
|
287
|
-
if (this.textParts.length
|
277
|
+
if (this.textParts.length !== 1) { this.errorInParseLogic(); }
|
288
278
|
return parseTextLiteral(this.textParts[0]);
|
289
279
|
}
|
290
280
|
var parsedFn = function(context) {
|
@@ -311,7 +301,7 @@ InterpolationParts.prototype.watchDelegate = function watchDelegate(scope, liste
|
|
311
301
|
function InterpolationPartsWatcher(interpolationParts, scope, listener, objectEquality) {
|
312
302
|
this.interpolationParts = interpolationParts;
|
313
303
|
this.scope = scope;
|
314
|
-
this.previousResult = (
|
304
|
+
this.previousResult = (undefined);
|
315
305
|
this.listener = listener;
|
316
306
|
var self = this;
|
317
307
|
this.expressionFnsWatcher = scope['$watchGroup'](interpolationParts.expressionFns, function(newExpressionValues, oldExpressionValues) {
|
@@ -321,9 +311,7 @@ function InterpolationPartsWatcher(interpolationParts, scope, listener, objectEq
|
|
321
311
|
|
322
312
|
InterpolationPartsWatcher.prototype.watchListener = function watchListener(newExpressionValues, oldExpressionValues) {
|
323
313
|
var result = this.interpolationParts.getResult(newExpressionValues);
|
324
|
-
|
325
|
-
this.listener.call(null, result, newExpressionValues === oldExpressionValues ? result : this.previousResult, this.scope);
|
326
|
-
}
|
314
|
+
this.listener.call(null, result, newExpressionValues === oldExpressionValues ? result : this.previousResult, this.scope);
|
327
315
|
this.previousResult = result;
|
328
316
|
};
|
329
317
|
|
@@ -423,7 +411,7 @@ MessageFormatParser.prototype.popState = function popState() {
|
|
423
411
|
MessageFormatParser.prototype.matchRe = function matchRe(re, search) {
|
424
412
|
re.lastIndex = this.index;
|
425
413
|
var match = re.exec(this.text);
|
426
|
-
if (match != null && (search === true || (match.index
|
414
|
+
if (match != null && (search === true || (match.index === this.index))) {
|
427
415
|
this.index = re.lastIndex;
|
428
416
|
return match;
|
429
417
|
}
|
@@ -461,7 +449,7 @@ MessageFormatParser.prototype.errorInParseLogic = function errorInParseLogic() {
|
|
461
449
|
};
|
462
450
|
|
463
451
|
MessageFormatParser.prototype.assertRuleOrNull = function assertRuleOrNull(rule) {
|
464
|
-
if (rule ===
|
452
|
+
if (rule === undefined) {
|
465
453
|
this.errorInParseLogic();
|
466
454
|
}
|
467
455
|
};
|
@@ -477,7 +465,7 @@ MessageFormatParser.prototype.errorExpecting = function errorExpecting() {
|
|
477
465
|
position.line, position.column, this.text);
|
478
466
|
}
|
479
467
|
var word = match[1];
|
480
|
-
if (word
|
468
|
+
if (word === 'select' || word === 'plural') {
|
481
469
|
position = indexToLineAndColumn(this.text, this.index);
|
482
470
|
throw $interpolateMinErr('reqcomma',
|
483
471
|
'Expected a comma after the keyword “{0}” at line {1}, column {2} of text “{3}”',
|
@@ -505,7 +493,7 @@ MessageFormatParser.prototype.ruleString = function ruleString() {
|
|
505
493
|
MessageFormatParser.prototype.startStringAtMatch = function startStringAtMatch(match) {
|
506
494
|
this.stringStartIndex = match.index;
|
507
495
|
this.stringQuote = match[0];
|
508
|
-
this.stringInterestsRe = this.stringQuote
|
496
|
+
this.stringInterestsRe = this.stringQuote === '\'' ? SQUOTED_STRING_INTEREST_RE : DQUOTED_STRING_INTEREST_RE;
|
509
497
|
this.rule = this.ruleInsideString;
|
510
498
|
};
|
511
499
|
|
@@ -519,8 +507,7 @@ MessageFormatParser.prototype.ruleInsideString = function ruleInsideString() {
|
|
519
507
|
'The string beginning at line {0}, column {1} is unterminated in text “{2}”',
|
520
508
|
position.line, position.column, this.text);
|
521
509
|
}
|
522
|
-
|
523
|
-
if (match == this.stringQuote) {
|
510
|
+
if (match[0] === this.stringQuote) {
|
524
511
|
this.rule = null;
|
525
512
|
}
|
526
513
|
};
|
@@ -533,8 +520,8 @@ MessageFormatParser.prototype.rulePluralOrSelect = function rulePluralOrSelect()
|
|
533
520
|
}
|
534
521
|
var argType = match[1];
|
535
522
|
switch (argType) {
|
536
|
-
case
|
537
|
-
case
|
523
|
+
case 'plural': this.rule = this.rulePluralStyle; break;
|
524
|
+
case 'select': this.rule = this.ruleSelectStyle; break;
|
538
525
|
default: this.errorInParseLogic();
|
539
526
|
}
|
540
527
|
};
|
@@ -552,7 +539,7 @@ MessageFormatParser.prototype.ruleSelectStyle = function ruleSelectStyle() {
|
|
552
539
|
};
|
553
540
|
|
554
541
|
var NUMBER_RE = /[0]|(?:[1-9][0-9]*)/g;
|
555
|
-
var PLURAL_OFFSET_RE = new RegExp(
|
542
|
+
var PLURAL_OFFSET_RE = new RegExp('\\s*offset\\s*:\\s*(' + NUMBER_RE.source + ')', 'g');
|
556
543
|
|
557
544
|
MessageFormatParser.prototype.rulePluralOffset = function rulePluralOffset() {
|
558
545
|
var match = this.matchRe(PLURAL_OFFSET_RE);
|
@@ -562,7 +549,7 @@ MessageFormatParser.prototype.rulePluralOffset = function rulePluralOffset() {
|
|
562
549
|
};
|
563
550
|
|
564
551
|
MessageFormatParser.prototype.assertChoiceKeyIsNew = function assertChoiceKeyIsNew(choiceKey, index) {
|
565
|
-
if (this.choices[choiceKey] !==
|
552
|
+
if (this.choices[choiceKey] !== undefined) {
|
566
553
|
var position = indexToLineAndColumn(this.text, index);
|
567
554
|
throw $interpolateMinErr('dupvalue',
|
568
555
|
'The choice “{0}” is specified more than once. Duplicate key is at line {1}, column {2} in text “{3}”',
|
@@ -583,7 +570,7 @@ MessageFormatParser.prototype.ruleSelectKeyword = function ruleSelectKeyword() {
|
|
583
570
|
this.rule = this.ruleMessageText;
|
584
571
|
};
|
585
572
|
|
586
|
-
var EXPLICIT_VALUE_OR_KEYWORD_RE = new RegExp(
|
573
|
+
var EXPLICIT_VALUE_OR_KEYWORD_RE = new RegExp('\\s*(?:(?:=(' + NUMBER_RE.source + '))|(\\w+))', 'g');
|
587
574
|
MessageFormatParser.prototype.rulePluralValueOrKeyword = function rulePluralValueOrKeyword() {
|
588
575
|
var match = this.matchRe(EXPLICIT_VALUE_OR_KEYWORD_RE);
|
589
576
|
if (match == null) {
|
@@ -600,7 +587,7 @@ MessageFormatParser.prototype.rulePluralValueOrKeyword = function rulePluralValu
|
|
600
587
|
this.rule = this.ruleMessageText;
|
601
588
|
};
|
602
589
|
|
603
|
-
var BRACE_OPEN_RE = /\s
|
590
|
+
var BRACE_OPEN_RE = /\s*\{/g;
|
604
591
|
var BRACE_CLOSE_RE = /}/g;
|
605
592
|
MessageFormatParser.prototype.ruleMessageText = function ruleMessageText() {
|
606
593
|
if (!this.consumeRe(BRACE_OPEN_RE)) {
|
@@ -620,7 +607,7 @@ var INTERP_OR_END_MESSAGE_RE = /\\.|{{|}/g;
|
|
620
607
|
var INTERP_OR_PLURALVALUE_OR_END_MESSAGE_RE = /\\.|{{|#|}/g;
|
621
608
|
var ESCAPE_OR_MUSTACHE_BEGIN_RE = /\\.|{{/g;
|
622
609
|
MessageFormatParser.prototype.advanceInInterpolationOrMessageText = function advanceInInterpolationOrMessageText() {
|
623
|
-
var currentIndex = this.index, match
|
610
|
+
var currentIndex = this.index, match;
|
624
611
|
if (this.ruleChoiceKeyword == null) { // interpolation
|
625
612
|
match = this.searchRe(ESCAPE_OR_MUSTACHE_BEGIN_RE);
|
626
613
|
if (match == null) { // End of interpolation text. Nothing more to process.
|
@@ -629,7 +616,7 @@ MessageFormatParser.prototype.advanceInInterpolationOrMessageText = function adv
|
|
629
616
|
return null;
|
630
617
|
}
|
631
618
|
} else {
|
632
|
-
match = this.searchRe(this.ruleChoiceKeyword
|
619
|
+
match = this.searchRe(this.ruleChoiceKeyword === this.rulePluralValueOrKeyword ?
|
633
620
|
INTERP_OR_PLURALVALUE_OR_END_MESSAGE_RE : INTERP_OR_END_MESSAGE_RE);
|
634
621
|
if (match == null) {
|
635
622
|
var position = indexToLineAndColumn(this.text, this.msgStartIndex);
|
@@ -654,20 +641,20 @@ MessageFormatParser.prototype.ruleInInterpolationOrMessageText = function ruleIn
|
|
654
641
|
this.rule = null;
|
655
642
|
return;
|
656
643
|
}
|
657
|
-
if (token[0]
|
644
|
+
if (token[0] === '\\') {
|
658
645
|
// unescape next character and continue
|
659
646
|
this.interpolationParts.addText(this.textPart + token[1]);
|
660
647
|
return;
|
661
648
|
}
|
662
649
|
this.interpolationParts.addText(this.textPart);
|
663
|
-
if (token
|
650
|
+
if (token === '{{') {
|
664
651
|
this.pushState();
|
665
652
|
this.ruleStack.push(this.ruleEndMustacheInInterpolationOrMessage);
|
666
653
|
this.rule = this.ruleEnteredMustache;
|
667
|
-
} else if (token
|
654
|
+
} else if (token === '}') {
|
668
655
|
this.choices[this.choiceKey] = this.interpolationParts.toParsedFn(/*mustHaveExpression=*/false, this.text);
|
669
656
|
this.rule = this.ruleChoiceKeyword;
|
670
|
-
} else if (token
|
657
|
+
} else if (token === '#') {
|
671
658
|
this.interpolationParts.addExpressionFn(this.expressionMinusOffsetFn);
|
672
659
|
} else {
|
673
660
|
this.errorInParseLogic();
|
@@ -691,7 +678,7 @@ MessageFormatParser.prototype.ruleInInterpolation = function ruleInInterpolation
|
|
691
678
|
return;
|
692
679
|
}
|
693
680
|
var token = match[0];
|
694
|
-
if (token[0]
|
681
|
+
if (token[0] === '\\') {
|
695
682
|
// unescape next character and continue
|
696
683
|
this.interpolationParts.addText(this.text.substring(currentIndex, match.index) + token[1]);
|
697
684
|
return;
|
@@ -738,7 +725,7 @@ MessageFormatParser.prototype.ruleEndMustache = function ruleEndMustache() {
|
|
738
725
|
// day), then the result *has* to be a string and those rules would have already set
|
739
726
|
// this.parsedFn. If there was no MessageFormat extension, then there is no requirement to
|
740
727
|
// stringify the result and parsedFn isn't set. We set it here. While we could have set it
|
741
|
-
// unconditionally when exiting the
|
728
|
+
// unconditionally when exiting the AngularJS expression, I intend for us to not just replace
|
742
729
|
// $interpolate, but also to replace $parse in a future version (so ng-bind can work), and in
|
743
730
|
// such a case we do not want to unnecessarily stringify something if it's not going to be used
|
744
731
|
// in a string context.
|
@@ -757,18 +744,18 @@ MessageFormatParser.prototype.ruleAngularExpression = function ruleAngularExpres
|
|
757
744
|
|
758
745
|
function getEndOperator(opBegin) {
|
759
746
|
switch (opBegin) {
|
760
|
-
case
|
761
|
-
case
|
762
|
-
case
|
747
|
+
case '{': return '}';
|
748
|
+
case '[': return ']';
|
749
|
+
case '(': return ')';
|
763
750
|
default: return null;
|
764
751
|
}
|
765
752
|
}
|
766
753
|
|
767
754
|
function getBeginOperator(opEnd) {
|
768
755
|
switch (opEnd) {
|
769
|
-
case
|
770
|
-
case
|
771
|
-
case
|
756
|
+
case '}': return '{';
|
757
|
+
case ']': return '[';
|
758
|
+
case ')': return '(';
|
772
759
|
default: return null;
|
773
760
|
}
|
774
761
|
}
|
@@ -778,12 +765,11 @@ function getBeginOperator(opEnd) {
|
|
778
765
|
// should support any other type of start/end interpolation symbol.
|
779
766
|
var INTERESTING_OPERATORS_RE = /[[\]{}()'",]/g;
|
780
767
|
MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularExpression() {
|
781
|
-
var startIndex = this.index;
|
782
768
|
var match = this.searchRe(INTERESTING_OPERATORS_RE);
|
783
769
|
var position;
|
784
770
|
if (match == null) {
|
785
771
|
if (this.angularOperatorStack.length === 0) {
|
786
|
-
// This is the end of the
|
772
|
+
// This is the end of the AngularJS expression so this is actually a
|
787
773
|
// success. Note that when inside an interpolation, this means we even
|
788
774
|
// consumed the closing interpolation symbols if they were curlies. This
|
789
775
|
// is NOT an error at this point but will become an error further up the
|
@@ -799,16 +785,16 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
|
|
799
785
|
}
|
800
786
|
var innermostOperator = this.angularOperatorStack[0];
|
801
787
|
throw $interpolateMinErr('badexpr',
|
802
|
-
'Unexpected end of
|
788
|
+
'Unexpected end of AngularJS expression. Expecting operator “{0}” at the end of the text “{1}”',
|
803
789
|
this.getEndOperator(innermostOperator), this.text);
|
804
790
|
}
|
805
791
|
var operator = match[0];
|
806
|
-
if (operator
|
792
|
+
if (operator === '\'' || operator === '"') {
|
807
793
|
this.ruleStack.push(this.ruleInAngularExpression);
|
808
794
|
this.startStringAtMatch(match);
|
809
795
|
return;
|
810
796
|
}
|
811
|
-
if (operator
|
797
|
+
if (operator === ',') {
|
812
798
|
if (this.trustedContext) {
|
813
799
|
position = indexToLineAndColumn(this.text, this.index);
|
814
800
|
throw $interpolateMinErr('unsafe',
|
@@ -836,7 +822,7 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
|
|
836
822
|
this.errorInParseLogic();
|
837
823
|
}
|
838
824
|
if (this.angularOperatorStack.length > 0) {
|
839
|
-
if (beginOperator
|
825
|
+
if (beginOperator === this.angularOperatorStack[0]) {
|
840
826
|
this.angularOperatorStack.shift();
|
841
827
|
return;
|
842
828
|
}
|
@@ -864,7 +850,6 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
|
|
864
850
|
/* global noop: true */
|
865
851
|
/* global toJson: true */
|
866
852
|
/* global MessageFormatParser: false */
|
867
|
-
/* global stringify: false */
|
868
853
|
|
869
854
|
/**
|
870
855
|
* @ngdoc module
|
@@ -875,7 +860,7 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
|
|
875
860
|
*
|
876
861
|
* ## What is ngMessageFormat?
|
877
862
|
*
|
878
|
-
* The ngMessageFormat module extends the
|
863
|
+
* The ngMessageFormat module extends the AngularJS {@link ng.$interpolate `$interpolate`} service
|
879
864
|
* with a syntax for handling pluralization and gender specific messages, which is based on the
|
880
865
|
* [ICU MessageFormat syntax][ICU].
|
881
866
|
*
|
@@ -909,9 +894,9 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
|
|
909
894
|
* this.gender = gender;
|
910
895
|
* }
|
911
896
|
*
|
912
|
-
* var alice = new Person(
|
913
|
-
* bob = new Person(
|
914
|
-
* ashley = new Person(
|
897
|
+
* var alice = new Person('Alice', 'female'),
|
898
|
+
* bob = new Person('Bob', 'male'),
|
899
|
+
* ashley = new Person('Ashley', '');
|
915
900
|
*
|
916
901
|
* angular.module('msgFmtExample', ['ngMessageFormat'])
|
917
902
|
* .controller('AppController', ['$scope', function($scope) {
|
@@ -952,11 +937,11 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
|
|
952
937
|
* this.gender = gender;
|
953
938
|
* }
|
954
939
|
*
|
955
|
-
* var alice = new Person(
|
956
|
-
* bob = new Person(
|
957
|
-
* sarah = new Person(
|
958
|
-
* harry = new Person(
|
959
|
-
* ashley = new Person(
|
940
|
+
* var alice = new Person('Alice', 'female'),
|
941
|
+
* bob = new Person('Bob', 'male'),
|
942
|
+
* sarah = new Person('Sarah', 'female'),
|
943
|
+
* harry = new Person('Harry Potter', 'male'),
|
944
|
+
* ashley = new Person('Ashley', '');
|
960
945
|
*
|
961
946
|
* angular.module('msgFmtExample', ['ngMessageFormat'])
|
962
947
|
* .controller('AppController', ['$scope', function($scope) {
|
@@ -1012,10 +997,10 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
|
|
1012
997
|
* this.gender = gender;
|
1013
998
|
* }
|
1014
999
|
*
|
1015
|
-
* var alice = new Person(
|
1016
|
-
* bob = new Person(
|
1017
|
-
* harry = new Person(
|
1018
|
-
* ashley = new Person(
|
1000
|
+
* var alice = new Person('Alice', 'female'),
|
1001
|
+
* bob = new Person('Bob', 'male'),
|
1002
|
+
* harry = new Person('Harry Potter', 'male'),
|
1003
|
+
* ashley = new Person('Ashley', '');
|
1019
1004
|
*
|
1020
1005
|
* angular.module('msgFmtExample', ['ngMessageFormat'])
|
1021
1006
|
* .controller('AppController', ['$scope', function($scope) {
|
@@ -1028,13 +1013,13 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
|
|
1028
1013
|
*/
|
1029
1014
|
|
1030
1015
|
var $$MessageFormatFactory = ['$parse', '$locale', '$sce', '$exceptionHandler', function $$messageFormat(
|
1031
|
-
|
1016
|
+
$parse, $locale, $sce, $exceptionHandler) {
|
1032
1017
|
|
1033
1018
|
function getStringifier(trustedContext, allOrNothing, text) {
|
1034
1019
|
return function stringifier(value) {
|
1035
1020
|
try {
|
1036
1021
|
value = trustedContext ? $sce['getTrusted'](trustedContext, value) : $sce['valueOf'](value);
|
1037
|
-
return allOrNothing && (value ===
|
1022
|
+
return allOrNothing && (value === undefined) ? value : $$stringify(value);
|
1038
1023
|
} catch (err) {
|
1039
1024
|
$exceptionHandler($interpolateMinErr['interr'](text, err));
|
1040
1025
|
}
|
@@ -1055,7 +1040,7 @@ var $$MessageFormatFactory = ['$parse', '$locale', '$sce', '$exceptionHandler',
|
|
1055
1040
|
}];
|
1056
1041
|
|
1057
1042
|
var $$interpolateDecorator = ['$$messageFormat', '$delegate', function $$interpolateDecorator($$messageFormat, $interpolate) {
|
1058
|
-
if ($interpolate['startSymbol']()
|
1043
|
+
if ($interpolate['startSymbol']() !== '{{' || $interpolate['endSymbol']() !== '}}') {
|
1059
1044
|
throw $interpolateMinErr('nochgmustache', 'angular-message-format.js currently does not allow you to use custom start and end symbols for interpolation.');
|
1060
1045
|
}
|
1061
1046
|
var interpolate = $$messageFormat['interpolate'];
|
@@ -1068,14 +1053,17 @@ var $interpolateMinErr;
|
|
1068
1053
|
var isFunction;
|
1069
1054
|
var noop;
|
1070
1055
|
var toJson;
|
1056
|
+
var $$stringify;
|
1071
1057
|
|
1072
|
-
var
|
1073
|
-
|
1074
|
-
|
1058
|
+
var ngModule = window['angular']['module']('ngMessageFormat', ['ng']);
|
1059
|
+
ngModule['info']({ 'angularVersion': '1.8.0' });
|
1060
|
+
ngModule['factory']('$$messageFormat', $$MessageFormatFactory);
|
1061
|
+
ngModule['config'](['$provide', function($provide) {
|
1075
1062
|
$interpolateMinErr = window['angular']['$interpolateMinErr'];
|
1076
1063
|
isFunction = window['angular']['isFunction'];
|
1077
1064
|
noop = window['angular']['noop'];
|
1078
1065
|
toJson = window['angular']['toJson'];
|
1066
|
+
$$stringify = window['angular']['$$stringify'];
|
1079
1067
|
|
1080
1068
|
$provide['decorator']('$interpolate', $$interpolateDecorator);
|
1081
1069
|
}]);
|