Skip to content

Commit 5345813

Browse files
petebacondarwinnetman92
authored andcommitted
style($$messageFormat) does not need to have a provider
1 parent ad285a4 commit 5345813

File tree

1 file changed

+23
-25
lines changed

1 file changed

+23
-25
lines changed

src/ngMessageFormat/messageFormatService.js

+23-25
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,32 @@
1818
* For more information, see:
1919
* https://docs.google.com/a/google.com/document/d/1pbtW2yvtmFBikfRrJd8VAsabiFkKezmYZ_PbgdjQOVU/edit
2020
*/
21-
function $$MessageFormatProvider() {
22-
this['$get'] = ['$parse', '$locale', '$sce', '$exceptionHandler', function $get(
21+
var $$MessageFormatFactory = ['$parse', '$locale', '$sce', '$exceptionHandler', function $$messageFormat(
2322
$parse, $locale, $sce, $exceptionHandler) {
2423

25-
function getStringifier(trustedContext, allOrNothing, text) {
26-
return function stringifier(value) {
27-
try {
28-
value = trustedContext ? $sce['getTrusted'](trustedContext, value) : $sce['valueOf'](value);
29-
return allOrNothing && (value === void 0) ? value : stringify(value);
30-
} catch (err) {
31-
$exceptionHandler($interpolateMinErr['interr'](text, err));
32-
}
33-
};
34-
}
24+
function getStringifier(trustedContext, allOrNothing, text) {
25+
return function stringifier(value) {
26+
try {
27+
value = trustedContext ? $sce['getTrusted'](trustedContext, value) : $sce['valueOf'](value);
28+
return allOrNothing && (value === void 0) ? value : stringify(value);
29+
} catch (err) {
30+
$exceptionHandler($interpolateMinErr['interr'](text, err));
31+
}
32+
};
33+
}
3534

36-
function interpolate(text, mustHaveExpression, trustedContext, allOrNothing) {
37-
var stringifier = getStringifier(trustedContext, allOrNothing, text);
38-
var parser = new MessageFormatParser(text, 0, $parse, $locale['pluralCat'], stringifier,
39-
mustHaveExpression, trustedContext, allOrNothing);
40-
parser.run(parser.ruleInterpolate);
41-
return parser.parsedFn;
42-
}
35+
function interpolate(text, mustHaveExpression, trustedContext, allOrNothing) {
36+
var stringifier = getStringifier(trustedContext, allOrNothing, text);
37+
var parser = new MessageFormatParser(text, 0, $parse, $locale['pluralCat'], stringifier,
38+
mustHaveExpression, trustedContext, allOrNothing);
39+
parser.run(parser.ruleInterpolate);
40+
return parser.parsedFn;
41+
}
4342

44-
return {
45-
'interpolate': interpolate
46-
};
47-
}];
48-
}
43+
return {
44+
'interpolate': interpolate
45+
};
46+
}];
4947

5048
var $$interpolateDecorator = ['$$messageFormat', '$delegate', function $$interpolateDecorator($$messageFormat, $interpolate) {
5149
if ($interpolate['startSymbol']() != "{{" || $interpolate['endSymbol']() != "}}") {
@@ -64,7 +62,7 @@ var $$interpolateDecorator = ['$$messageFormat', '$delegate', function $$interpo
6462
* @description
6563
*/
6664
var module = angular['module']('ngMessageFormat', ['ng']);
67-
module['provider']('$$messageFormat', $$MessageFormatProvider);
65+
module['factory']('$$messageFormat', $$MessageFormatFactory);
6866
module['config'](['$provide', function($provide) {
6967
$provide['decorator']('$interpolate', $$interpolateDecorator);
7068
}]);

0 commit comments

Comments
 (0)