angularjs-rails 1.5.6 → 1.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/angularjs-rails/version.rb +1 -1
- data/vendor/assets/javascripts/angular-animate.js +40 -49
- data/vendor/assets/javascripts/angular-aria.js +1 -1
- data/vendor/assets/javascripts/angular-cookies.js +1 -1
- data/vendor/assets/javascripts/angular-loader.js +3 -3
- data/vendor/assets/javascripts/angular-message-format.js +136 -32
- data/vendor/assets/javascripts/angular-messages.js +394 -379
- data/vendor/assets/javascripts/angular-mocks.js +30 -16
- data/vendor/assets/javascripts/angular-parse-ext.js +1 -1
- data/vendor/assets/javascripts/angular-resource.js +104 -9
- data/vendor/assets/javascripts/angular-route.js +39 -2
- data/vendor/assets/javascripts/angular-sanitize.js +319 -298
- data/vendor/assets/javascripts/angular-scenario.js +2639 -1602
- data/vendor/assets/javascripts/angular-touch.js +15 -9
- data/vendor/assets/javascripts/angular.js +1167 -422
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d04d5e9d07101020a4ff8ce65da72f687ae662ac
|
4
|
+
data.tar.gz: a331710f55c8863f808ff55b19e13f7fbea622d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a6f1fd278f3a44256c869257be4ba5ce847847dd1f7061bb0e8d865207a7a628bfec0549ed5e7217987325bc5f3423d1bd7306dff786dc39a4d796d1ff46387
|
7
|
+
data.tar.gz: ac1409c3a42f91f5801b8084e8ade1a5f9f06e2519c55100ff7f2817210d92d88ad890a16037d03f9019e0aa74a8fabba2881f1687d7e743b797f79884d31e24
|
@@ -1,24 +1,10 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.5.
|
2
|
+
* @license AngularJS v1.5.8
|
3
3
|
* (c) 2010-2016 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
6
6
|
(function(window, angular) {'use strict';
|
7
7
|
|
8
|
-
/* jshint ignore:start */
|
9
|
-
var noop = angular.noop;
|
10
|
-
var copy = angular.copy;
|
11
|
-
var extend = angular.extend;
|
12
|
-
var jqLite = angular.element;
|
13
|
-
var forEach = angular.forEach;
|
14
|
-
var isArray = angular.isArray;
|
15
|
-
var isString = angular.isString;
|
16
|
-
var isObject = angular.isObject;
|
17
|
-
var isUndefined = angular.isUndefined;
|
18
|
-
var isDefined = angular.isDefined;
|
19
|
-
var isFunction = angular.isFunction;
|
20
|
-
var isElement = angular.isElement;
|
21
|
-
|
22
8
|
var ELEMENT_NODE = 1;
|
23
9
|
var COMMENT_NODE = 8;
|
24
10
|
|
@@ -43,7 +29,7 @@ var CSS_PREFIX = '', TRANSITION_PROP, TRANSITIONEND_EVENT, ANIMATION_PROP, ANIMA
|
|
43
29
|
// Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit
|
44
30
|
// therefore there is no reason to test anymore for other vendor prefixes:
|
45
31
|
// http://caniuse.com/#search=transition
|
46
|
-
if (
|
32
|
+
if ((window.ontransitionend === void 0) && (window.onwebkittransitionend !== void 0)) {
|
47
33
|
CSS_PREFIX = '-webkit-';
|
48
34
|
TRANSITION_PROP = 'WebkitTransition';
|
49
35
|
TRANSITIONEND_EVENT = 'webkitTransitionEnd transitionend';
|
@@ -52,7 +38,7 @@ if (isUndefined(window.ontransitionend) && isDefined(window.onwebkittransitionen
|
|
52
38
|
TRANSITIONEND_EVENT = 'transitionend';
|
53
39
|
}
|
54
40
|
|
55
|
-
if (
|
41
|
+
if ((window.onanimationend === void 0) && (window.onwebkitanimationend !== void 0)) {
|
56
42
|
CSS_PREFIX = '-webkit-';
|
57
43
|
ANIMATION_PROP = 'WebkitAnimation';
|
58
44
|
ANIMATIONEND_EVENT = 'webkitAnimationEnd animationend';
|
@@ -74,10 +60,6 @@ var ANIMATION_DURATION_PROP = ANIMATION_PROP + DURATION_KEY;
|
|
74
60
|
var TRANSITION_DELAY_PROP = TRANSITION_PROP + DELAY_KEY;
|
75
61
|
var TRANSITION_DURATION_PROP = TRANSITION_PROP + DURATION_KEY;
|
76
62
|
|
77
|
-
var isPromiseLike = function(p) {
|
78
|
-
return p && p.then ? true : false;
|
79
|
-
};
|
80
|
-
|
81
63
|
var ngMinErr = angular.$$minErr('ng');
|
82
64
|
function assertArg(arg, name, reason) {
|
83
65
|
if (!arg) {
|
@@ -133,7 +115,6 @@ function stripCommentsFromElement(element) {
|
|
133
115
|
switch (element.length) {
|
134
116
|
case 0:
|
135
117
|
return element;
|
136
|
-
break;
|
137
118
|
|
138
119
|
case 1:
|
139
120
|
// there is no point of stripping anything if the element
|
@@ -146,7 +127,6 @@ function stripCommentsFromElement(element) {
|
|
146
127
|
|
147
128
|
default:
|
148
129
|
return jqLite(extractElementNode(element));
|
149
|
-
break;
|
150
130
|
}
|
151
131
|
}
|
152
132
|
|
@@ -187,7 +167,7 @@ function applyAnimationClassesFactory($$jqLite) {
|
|
187
167
|
$$removeClass($$jqLite, element, options.removeClass);
|
188
168
|
options.removeClass = null;
|
189
169
|
}
|
190
|
-
}
|
170
|
+
};
|
191
171
|
}
|
192
172
|
|
193
173
|
function prepareAnimationOptions(options) {
|
@@ -290,10 +270,10 @@ function resolveElementClasses(existing, toAdd, toRemove) {
|
|
290
270
|
var prop, allow;
|
291
271
|
if (val === ADD_CLASS) {
|
292
272
|
prop = 'addClass';
|
293
|
-
allow = !existing[klass];
|
273
|
+
allow = !existing[klass] || existing[klass + REMOVE_CLASS_SUFFIX];
|
294
274
|
} else if (val === REMOVE_CLASS) {
|
295
275
|
prop = 'removeClass';
|
296
|
-
allow = existing[klass];
|
276
|
+
allow = existing[klass] || existing[klass + ADD_CLASS_SUFFIX];
|
297
277
|
}
|
298
278
|
if (allow) {
|
299
279
|
if (classes[prop].length) {
|
@@ -323,7 +303,7 @@ function resolveElementClasses(existing, toAdd, toRemove) {
|
|
323
303
|
}
|
324
304
|
|
325
305
|
function getDomNode(element) {
|
326
|
-
return (element instanceof
|
306
|
+
return (element instanceof jqLite) ? element[0] : element;
|
327
307
|
}
|
328
308
|
|
329
309
|
function applyGeneratedPreparationClasses(element, event, options) {
|
@@ -513,7 +493,7 @@ var $$AnimateChildrenDirective = ['$interpolate', function($interpolate) {
|
|
513
493
|
return {
|
514
494
|
link: function(scope, element, attrs) {
|
515
495
|
var val = attrs.ngAnimateChildren;
|
516
|
-
if (
|
496
|
+
if (isString(val) && val.length === 0) { //empty attribute
|
517
497
|
element.data(NG_ANIMATE_CHILDREN_DATA, true);
|
518
498
|
} else {
|
519
499
|
// Interpolate and set the value, so that it is available to
|
@@ -2299,7 +2279,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
|
|
2299
2279
|
}
|
2300
2280
|
);
|
2301
2281
|
|
2302
|
-
var callbackRegistry =
|
2282
|
+
var callbackRegistry = Object.create(null);
|
2303
2283
|
|
2304
2284
|
// remember that the classNameFilter is set during the provider/config
|
2305
2285
|
// stage therefore we can optimize here and setup a helper function
|
@@ -2382,7 +2362,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
|
|
2382
2362
|
},
|
2383
2363
|
|
2384
2364
|
off: function(event, container, callback) {
|
2385
|
-
if (arguments.length === 1 && !
|
2365
|
+
if (arguments.length === 1 && !isString(arguments[0])) {
|
2386
2366
|
container = arguments[0];
|
2387
2367
|
for (var eventType in callbackRegistry) {
|
2388
2368
|
callbackRegistry[eventType] = filterFromRegistry(callbackRegistry[eventType], container);
|
@@ -2430,11 +2410,10 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
|
|
2430
2410
|
bool = animationsEnabled = !!element;
|
2431
2411
|
} else {
|
2432
2412
|
var node = getDomNode(element);
|
2433
|
-
var recordExists = disabledElementsLookup.get(node);
|
2434
2413
|
|
2435
2414
|
if (argCount === 1) {
|
2436
2415
|
// (element) - Element getter
|
2437
|
-
bool = !
|
2416
|
+
bool = !disabledElementsLookup.get(node);
|
2438
2417
|
} else {
|
2439
2418
|
// (element, bool) - Element setter
|
2440
2419
|
disabledElementsLookup.put(node, !bool);
|
@@ -3213,8 +3192,6 @@ var $$AnimationProvider = ['$animateProvider', function($animateProvider) {
|
|
3213
3192
|
// may attempt more elements, but custom drivers are more particular
|
3214
3193
|
for (var i = drivers.length - 1; i >= 0; i--) {
|
3215
3194
|
var driverName = drivers[i];
|
3216
|
-
if (!$injector.has(driverName)) continue; // TODO(matsko): remove this check
|
3217
|
-
|
3218
3195
|
var factory = $injector.get(driverName);
|
3219
3196
|
var driver = factory(animationDetails);
|
3220
3197
|
if (driver) {
|
@@ -3389,20 +3366,6 @@ var ngAnimateSwapDirective = ['$animate', '$rootScope', function($animate, $root
|
|
3389
3366
|
};
|
3390
3367
|
}];
|
3391
3368
|
|
3392
|
-
/* global angularAnimateModule: true,
|
3393
|
-
|
3394
|
-
ngAnimateSwapDirective,
|
3395
|
-
$$AnimateAsyncRunFactory,
|
3396
|
-
$$rAFSchedulerFactory,
|
3397
|
-
$$AnimateChildrenDirective,
|
3398
|
-
$$AnimateQueueProvider,
|
3399
|
-
$$AnimationProvider,
|
3400
|
-
$AnimateCssProvider,
|
3401
|
-
$$AnimateCssDriverProvider,
|
3402
|
-
$$AnimateJsProvider,
|
3403
|
-
$$AnimateJsDriverProvider,
|
3404
|
-
*/
|
3405
|
-
|
3406
3369
|
/**
|
3407
3370
|
* @ngdoc module
|
3408
3371
|
* @name ngAnimate
|
@@ -4119,6 +4082,19 @@ var ngAnimateSwapDirective = ['$animate', '$rootScope', function($animate, $root
|
|
4119
4082
|
* (Note that you will need to trigger a digest within the callback to get angular to notice any scope-related changes.)
|
4120
4083
|
*/
|
4121
4084
|
|
4085
|
+
var copy;
|
4086
|
+
var extend;
|
4087
|
+
var forEach;
|
4088
|
+
var isArray;
|
4089
|
+
var isDefined;
|
4090
|
+
var isElement;
|
4091
|
+
var isFunction;
|
4092
|
+
var isObject;
|
4093
|
+
var isString;
|
4094
|
+
var isUndefined;
|
4095
|
+
var jqLite;
|
4096
|
+
var noop;
|
4097
|
+
|
4122
4098
|
/**
|
4123
4099
|
* @ngdoc service
|
4124
4100
|
* @name $animate
|
@@ -4129,7 +4105,22 @@ var ngAnimateSwapDirective = ['$animate', '$rootScope', function($animate, $root
|
|
4129
4105
|
*
|
4130
4106
|
* Click here {@link ng.$animate to learn more about animations with `$animate`}.
|
4131
4107
|
*/
|
4132
|
-
angular.module('ngAnimate', [])
|
4108
|
+
angular.module('ngAnimate', [], function initAngularHelpers() {
|
4109
|
+
// Access helpers from angular core.
|
4110
|
+
// Do it inside a `config` block to ensure `window.angular` is available.
|
4111
|
+
noop = angular.noop;
|
4112
|
+
copy = angular.copy;
|
4113
|
+
extend = angular.extend;
|
4114
|
+
jqLite = angular.element;
|
4115
|
+
forEach = angular.forEach;
|
4116
|
+
isArray = angular.isArray;
|
4117
|
+
isString = angular.isString;
|
4118
|
+
isObject = angular.isObject;
|
4119
|
+
isUndefined = angular.isUndefined;
|
4120
|
+
isDefined = angular.isDefined;
|
4121
|
+
isFunction = angular.isFunction;
|
4122
|
+
isElement = angular.isElement;
|
4123
|
+
})
|
4133
4124
|
.directive('ngAnimateSwap', ngAnimateSwapDirective)
|
4134
4125
|
|
4135
4126
|
.directive('ngAnimateChildren', $$AnimateChildrenDirective)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.5.
|
2
|
+
* @license AngularJS v1.5.8
|
3
3
|
* (c) 2010-2016 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -7,7 +7,7 @@
|
|
7
7
|
(function() {'use strict';
|
8
8
|
function isFunction(value) {return typeof value === 'function';};
|
9
9
|
|
10
|
-
/* global
|
10
|
+
/* global toDebugString: true */
|
11
11
|
|
12
12
|
function serializeObject(obj) {
|
13
13
|
var seen = [];
|
@@ -87,7 +87,7 @@ function minErr(module, ErrorConstructor) {
|
|
87
87
|
return match;
|
88
88
|
});
|
89
89
|
|
90
|
-
message += '\nhttp://errors.angularjs.org/1.5.
|
90
|
+
message += '\nhttp://errors.angularjs.org/1.5.8/' +
|
91
91
|
(module ? module + '/' : '') + code;
|
92
92
|
|
93
93
|
for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.5.
|
2
|
+
* @license AngularJS v1.5.8
|
3
3
|
* (c) 2010-2016 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -10,11 +10,9 @@
|
|
10
10
|
// This file is compiled with Closure compiler's ADVANCED_OPTIMIZATIONS flag! Be wary of using
|
11
11
|
// constructs incompatible with that mode.
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
isFunction = window['angular']['isFunction'],
|
17
|
-
toJson = window['angular']['toJson'];
|
13
|
+
/* global isFunction: false */
|
14
|
+
/* global noop: false */
|
15
|
+
/* global toJson: false */
|
18
16
|
|
19
17
|
function stringify(value) {
|
20
18
|
if (value == null /* null/undefined */) { return ''; }
|
@@ -861,31 +859,90 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
|
|
861
859
|
// This file is compiled with Closure compiler's ADVANCED_OPTIMIZATIONS flag! Be wary of using
|
862
860
|
// constructs incompatible with that mode.
|
863
861
|
|
864
|
-
/* global $interpolateMinErr:
|
862
|
+
/* global $interpolateMinErr: true */
|
863
|
+
/* global isFunction: true */
|
864
|
+
/* global noop: true */
|
865
|
+
/* global toJson: true */
|
865
866
|
/* global MessageFormatParser: false */
|
866
867
|
/* global stringify: false */
|
867
868
|
|
868
869
|
/**
|
869
|
-
* @ngdoc
|
870
|
-
* @name
|
870
|
+
* @ngdoc module
|
871
|
+
* @name ngMessageFormat
|
872
|
+
* @packageName angular-message-format
|
871
873
|
*
|
872
874
|
* @description
|
873
|
-
* Angular internal service to recognize MessageFormat extensions in interpolation expressions.
|
874
|
-
* For more information, see:
|
875
|
-
* https://docs.google.com/a/google.com/document/d/1pbtW2yvtmFBikfRrJd8VAsabiFkKezmYZ_PbgdjQOVU/edit
|
876
875
|
*
|
877
|
-
* ##
|
876
|
+
* ## What is ngMessageFormat?
|
877
|
+
*
|
878
|
+
* The ngMessageFormat module extends the Angular {@link ng.$interpolate `$interpolate`} service
|
879
|
+
* with a syntax for handling pluralization and gender specific messages, which is based on the
|
880
|
+
* [ICU MessageFormat syntax][ICU].
|
881
|
+
*
|
882
|
+
* See [the design doc][ngMessageFormat doc] for more information.
|
883
|
+
*
|
884
|
+
* [ICU]: http://userguide.icu-project.org/formatparse/messages#TOC-MessageFormat
|
885
|
+
* [ngMessageFormat doc]: https://docs.google.com/a/google.com/document/d/1pbtW2yvtmFBikfRrJd8VAsabiFkKezmYZ_PbgdjQOVU/edit
|
886
|
+
*
|
887
|
+
* ## Examples
|
888
|
+
*
|
889
|
+
* ### Gender
|
890
|
+
*
|
891
|
+
* This example uses the "select" keyword to specify the message based on gender.
|
892
|
+
*
|
893
|
+
* <example name="ngMessageFormat-example-gender" module="msgFmtExample" deps="angular-message-format.js">
|
894
|
+
* <file name="index.html">
|
895
|
+
* <div ng-controller="AppController">
|
896
|
+
* Select Recipient:<br>
|
897
|
+
<select ng-model="recipient" ng-options="person as person.name for person in recipients">
|
898
|
+
</select>
|
899
|
+
<p>{{recipient.gender, select,
|
900
|
+
male {{{recipient.name}} unwrapped his gift. }
|
901
|
+
female {{{recipient.name}} unwrapped her gift. }
|
902
|
+
other {{{recipient.name}} unwrapped their gift. }
|
903
|
+
}}</p>
|
904
|
+
* </div>
|
905
|
+
* </file>
|
906
|
+
* <file name="script.js">
|
907
|
+
* function Person(name, gender) {
|
908
|
+
* this.name = name;
|
909
|
+
* this.gender = gender;
|
910
|
+
* }
|
911
|
+
*
|
912
|
+
* var alice = new Person("Alice", "female"),
|
913
|
+
* bob = new Person("Bob", "male"),
|
914
|
+
* ashley = new Person("Ashley", "");
|
915
|
+
*
|
916
|
+
* angular.module('msgFmtExample', ['ngMessageFormat'])
|
917
|
+
* .controller('AppController', ['$scope', function($scope) {
|
918
|
+
* $scope.recipients = [alice, bob, ashley];
|
919
|
+
* $scope.recipient = $scope.recipients[0];
|
920
|
+
* }]);
|
921
|
+
* </file>
|
922
|
+
* </example>
|
923
|
+
*
|
924
|
+
* ### Plural
|
925
|
+
*
|
926
|
+
* This example shows how the "plural" keyword is used to account for a variable number of entities.
|
927
|
+
* The "#" variable holds the current number and can be embedded in the message.
|
928
|
+
*
|
929
|
+
* Note that "=1" takes precedence over "one".
|
878
930
|
*
|
879
|
-
*
|
931
|
+
* The example also shows the "offset" keyword, which allows you to offset the value of the "#" variable.
|
932
|
+
*
|
933
|
+
* <example name="ngMessageFormat-example-plural" module="msgFmtExample" deps="angular-message-format.js">
|
880
934
|
* <file name="index.html">
|
881
935
|
* <div ng-controller="AppController">
|
882
|
-
*
|
883
|
-
*
|
936
|
+
* <button ng-click="recipients.pop()" id="decreaseRecipients">decreaseRecipients</button><br>
|
937
|
+
* Select recipients:<br>
|
938
|
+
* <select multiple size=5 ng-model="recipients" ng-options="person as person.name for person in people">
|
939
|
+
* </select><br>
|
940
|
+
* <p>{{recipients.length, plural, offset:1
|
884
941
|
* =0 {{{sender.name}} gave no gifts (\#=#)}
|
885
|
-
* =1 {{{sender.name}} gave
|
942
|
+
* =1 {{{sender.name}} gave a gift to {{recipients[0].name}} (\#=#)}
|
886
943
|
* one {{{sender.name}} gave {{recipients[0].name}} and one other person a gift (\#=#)}
|
887
944
|
* other {{{sender.name}} gave {{recipients[0].name}} and # other people a gift (\#=#)}
|
888
|
-
* }}</
|
945
|
+
* }}</p>
|
889
946
|
* </div>
|
890
947
|
* </file>
|
891
948
|
*
|
@@ -897,35 +954,79 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
|
|
897
954
|
*
|
898
955
|
* var alice = new Person("Alice", "female"),
|
899
956
|
* bob = new Person("Bob", "male"),
|
900
|
-
*
|
901
|
-
* harry = new Person("Harry Potter", "male")
|
957
|
+
* sarah = new Person("Sarah", "female"),
|
958
|
+
* harry = new Person("Harry Potter", "male"),
|
959
|
+
* ashley = new Person("Ashley", "");
|
902
960
|
*
|
903
961
|
* angular.module('msgFmtExample', ['ngMessageFormat'])
|
904
962
|
* .controller('AppController', ['$scope', function($scope) {
|
905
|
-
* $scope.
|
963
|
+
* $scope.people = [alice, bob, sarah, ashley];
|
964
|
+
* $scope.recipients = [alice, bob, sarah];
|
906
965
|
* $scope.sender = harry;
|
907
|
-
* $scope.decreaseRecipients = function() {
|
908
|
-
* --$scope.recipients.length;
|
909
|
-
* };
|
910
966
|
* }]);
|
911
967
|
* </file>
|
912
968
|
*
|
913
969
|
* <file name="protractor.js" type="protractor">
|
914
970
|
* describe('MessageFormat plural', function() {
|
971
|
+
*
|
915
972
|
* it('should pluralize initial values', function() {
|
916
|
-
* var messageElem = element(by.binding('recipients.length')),
|
973
|
+
* var messageElem = element(by.binding('recipients.length')),
|
974
|
+
* decreaseRecipientsBtn = element(by.id('decreaseRecipients'));
|
975
|
+
*
|
917
976
|
* expect(messageElem.getText()).toEqual('Harry Potter gave Alice and 2 other people a gift (#=2)');
|
918
977
|
* decreaseRecipientsBtn.click();
|
919
978
|
* expect(messageElem.getText()).toEqual('Harry Potter gave Alice and one other person a gift (#=1)');
|
920
979
|
* decreaseRecipientsBtn.click();
|
921
|
-
* expect(messageElem.getText()).toEqual('Harry Potter gave
|
980
|
+
* expect(messageElem.getText()).toEqual('Harry Potter gave a gift to Alice (#=0)');
|
922
981
|
* decreaseRecipientsBtn.click();
|
923
982
|
* expect(messageElem.getText()).toEqual('Harry Potter gave no gifts (#=-1)');
|
924
983
|
* });
|
925
984
|
* });
|
926
985
|
* </file>
|
927
986
|
* </example>
|
987
|
+
*
|
988
|
+
* ### Plural and Gender together
|
989
|
+
*
|
990
|
+
* This example shows how you can specify gender rules for specific plural matches - in this case,
|
991
|
+
* =1 is special cased for gender.
|
992
|
+
* <example name="ngMessageFormat-example-plural-gender" module="msgFmtExample" deps="angular-message-format.js">
|
993
|
+
* <file name="index.html">
|
994
|
+
* <div ng-controller="AppController">
|
995
|
+
Select recipients:<br>
|
996
|
+
<select multiple size=5 ng-model="recipients" ng-options="person as person.name for person in people">
|
997
|
+
</select><br>
|
998
|
+
<p>{{recipients.length, plural,
|
999
|
+
=0 {{{sender.name}} has not given any gifts to anyone.}
|
1000
|
+
=1 { {{recipients[0].gender, select,
|
1001
|
+
female { {{sender.name}} gave {{recipients[0].name}} her gift.}
|
1002
|
+
male { {{sender.name}} gave {{recipients[0].name}} his gift.}
|
1003
|
+
other { {{sender.name}} gave {{recipients[0].name}} their gift.}
|
1004
|
+
}}
|
1005
|
+
}
|
1006
|
+
other {{{sender.name}} gave {{recipients.length}} people gifts.}
|
1007
|
+
}}</p>
|
1008
|
+
</file>
|
1009
|
+
* <file name="script.js">
|
1010
|
+
* function Person(name, gender) {
|
1011
|
+
* this.name = name;
|
1012
|
+
* this.gender = gender;
|
1013
|
+
* }
|
1014
|
+
*
|
1015
|
+
* var alice = new Person("Alice", "female"),
|
1016
|
+
* bob = new Person("Bob", "male"),
|
1017
|
+
* harry = new Person("Harry Potter", "male"),
|
1018
|
+
* ashley = new Person("Ashley", "");
|
1019
|
+
*
|
1020
|
+
* angular.module('msgFmtExample', ['ngMessageFormat'])
|
1021
|
+
* .controller('AppController', ['$scope', function($scope) {
|
1022
|
+
* $scope.people = [alice, bob, ashley];
|
1023
|
+
* $scope.recipients = [alice];
|
1024
|
+
* $scope.sender = harry;
|
1025
|
+
* }]);
|
1026
|
+
* </file>
|
1027
|
+
</example>
|
928
1028
|
*/
|
1029
|
+
|
929
1030
|
var $$MessageFormatFactory = ['$parse', '$locale', '$sce', '$exceptionHandler', function $$messageFormat(
|
930
1031
|
$parse, $locale, $sce, $exceptionHandler) {
|
931
1032
|
|
@@ -963,16 +1064,19 @@ var $$interpolateDecorator = ['$$messageFormat', '$delegate', function $$interpo
|
|
963
1064
|
return interpolate;
|
964
1065
|
}];
|
965
1066
|
|
1067
|
+
var $interpolateMinErr;
|
1068
|
+
var isFunction;
|
1069
|
+
var noop;
|
1070
|
+
var toJson;
|
966
1071
|
|
967
|
-
/**
|
968
|
-
* @ngdoc module
|
969
|
-
* @name ngMessageFormat
|
970
|
-
* @packageName angular-message-format
|
971
|
-
* @description
|
972
|
-
*/
|
973
1072
|
var module = window['angular']['module']('ngMessageFormat', ['ng']);
|
974
1073
|
module['factory']('$$messageFormat', $$MessageFormatFactory);
|
975
1074
|
module['config'](['$provide', function($provide) {
|
1075
|
+
$interpolateMinErr = window['angular']['$interpolateMinErr'];
|
1076
|
+
isFunction = window['angular']['isFunction'];
|
1077
|
+
noop = window['angular']['noop'];
|
1078
|
+
toJson = window['angular']['toJson'];
|
1079
|
+
|
976
1080
|
$provide['decorator']('$interpolate', $$interpolateDecorator);
|
977
1081
|
}]);
|
978
1082
|
|