@@ -22,6 +22,16 @@ angular.module('ui.select', [])
22
22
placeholder : '' // Empty by default, like HTML tag <select>
23
23
} )
24
24
25
+ // See Rename minErr and make it accessible from outside https://github.com/angular/angular.js/issues/6913
26
+ . service ( 'uiSelectMinErr' , function ( ) {
27
+ var minErr = angular . $$minErr ( 'ui.select' ) ;
28
+ return function ( ) {
29
+ var error = minErr . apply ( this , arguments ) ;
30
+ var message = error . message . replace ( new RegExp ( '\nhttp://errors.angularjs.org/.*' ) , '' ) ;
31
+ return new Error ( message ) ;
32
+ }
33
+ } )
34
+
25
35
/**
26
36
* Parses "repeat" attribute.
27
37
*
@@ -31,7 +41,7 @@ angular.module('ui.select', [])
31
41
* Original discussion about parsing "repeat" attribute instead of fully relying on ng-repeat:
32
42
* https://github.com/angular-ui/ui-select/commit/5dd63ad#commitcomment-5504697
33
43
*/
34
- . service ( 'RepeatParser' , function ( ) {
44
+ . service ( 'RepeatParser' , [ 'uiSelectMinErr' , function ( uiSelectMinErr ) {
35
45
var self = this ;
36
46
37
47
/**
@@ -47,8 +57,8 @@ angular.module('ui.select', [])
47
57
var match = expression . match ( / ^ \s * ( [ \s \S ] + ?) \s + i n \s + ( [ \s \S ] + ?) (?: \s + t r a c k \s + b y \s + ( [ \s \S ] + ?) ) ? \s * $ / ) ;
48
58
49
59
if ( ! match ) {
50
- throw new Error ( "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'." ,
51
- expression ) ;
60
+ throw uiSelectMinErr ( 'iexp' , "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'." ,
61
+ expression ) ;
52
62
}
53
63
54
64
var lhs = match [ 1 ] ; // Left-hand side
@@ -57,8 +67,8 @@ angular.module('ui.select', [])
57
67
58
68
match = lhs . match ( / ^ (?: ( [ \$ \w ] + ) | \( ( [ \$ \w ] + ) \s * , \s * ( [ \$ \w ] + ) \) ) $ / ) ;
59
69
if ( ! match ) {
60
- throw new Error ( "'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'." ,
61
- lhs ) ;
70
+ throw uiSelectMinErr ( 'iidexp' , "'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'." ,
71
+ lhs ) ;
62
72
}
63
73
64
74
var valueIdentifier = match [ 3 ] || match [ 1 ] ;
@@ -78,7 +88,7 @@ angular.module('ui.select', [])
78
88
}
79
89
return expression ;
80
90
} ;
81
- } )
91
+ } ] )
82
92
83
93
/**
84
94
* Contains ui-select "intelligence".
0 commit comments