18
18
* For more information, see:
19
19
* https://docs.google.com/a/google.com/document/d/1pbtW2yvtmFBikfRrJd8VAsabiFkKezmYZ_PbgdjQOVU/edit
20
20
*/
21
- function $$MessageFormatProvider ( ) {
22
- this [ '$get' ] = [ '$parse' , '$locale' , '$sce' , '$exceptionHandler' , function $get (
21
+ var $$MessageFormatFactory = [ '$parse' , '$locale' , '$sce' , '$exceptionHandler' , function $$messageFormat (
23
22
$parse , $locale , $sce , $exceptionHandler ) {
24
23
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
+ }
35
34
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
+ }
43
42
44
- return {
45
- 'interpolate' : interpolate
46
- } ;
47
- } ] ;
48
- }
43
+ return {
44
+ 'interpolate' : interpolate
45
+ } ;
46
+ } ] ;
49
47
50
48
var $$interpolateDecorator = [ '$$messageFormat' , '$delegate' , function $$interpolateDecorator ( $$messageFormat , $interpolate ) {
51
49
if ( $interpolate [ 'startSymbol' ] ( ) != "{{" || $interpolate [ 'endSymbol' ] ( ) != "}}" ) {
@@ -64,7 +62,7 @@ var $$interpolateDecorator = ['$$messageFormat', '$delegate', function $$interpo
64
62
* @description
65
63
*/
66
64
var module = angular [ 'module' ] ( 'ngMessageFormat' , [ 'ng' ] ) ;
67
- module [ 'provider ' ] ( '$$messageFormat' , $$MessageFormatProvider ) ;
65
+ module [ 'factory ' ] ( '$$messageFormat' , $$MessageFormatFactory ) ;
68
66
module [ 'config' ] ( [ '$provide' , function ( $provide ) {
69
67
$provide [ 'decorator' ] ( '$interpolate' , $$interpolateDecorator ) ;
70
68
} ] ) ;
0 commit comments