@@ -192,7 +192,9 @@ function $InterpolateProvider() {
192
192
textLength = text . length ,
193
193
exp ,
194
194
concat = [ ] ,
195
- expressionPositions = [ ] ;
195
+ expressionPositions = [ ] ,
196
+ interceptor = allOrNothing ? allOrNothingParseStringifyInterceptor :
197
+ parseStringifyInterceptor ;
196
198
197
199
while ( index < textLength ) {
198
200
if ( ( ( startIndex = text . indexOf ( startSymbol , index ) ) != - 1 ) &&
@@ -202,7 +204,7 @@ function $InterpolateProvider() {
202
204
}
203
205
exp = text . substring ( startIndex + startSymbolLength , endIndex ) ;
204
206
expressions . push ( exp ) ;
205
- parseFns . push ( $parse ( exp , parseStringifyInterceptor ) ) ;
207
+ parseFns . push ( $parse ( exp , interceptor ) ) ;
206
208
index = endIndex + endSymbolLength ;
207
209
expressionPositions . push ( concat . length ) ;
208
210
concat . push ( '' ) ;
@@ -231,7 +233,9 @@ function $InterpolateProvider() {
231
233
if ( ! mustHaveExpression || expressions . length ) {
232
234
var compute = function ( values ) {
233
235
for ( var i = 0 , ii = expressions . length ; i < ii ; i ++ ) {
234
- if ( allOrNothing && isUndefined ( values [ i ] ) ) return ;
236
+ if ( allOrNothing && isUndefined ( values [ i ] ) ) {
237
+ return ;
238
+ }
235
239
concat [ expressionPositions [ i ] ] = values [ i ] ;
236
240
}
237
241
return concat . join ( '' ) ;
@@ -308,6 +312,20 @@ function $InterpolateProvider() {
308
312
$exceptionHandler ( newErr ) ;
309
313
}
310
314
}
315
+
316
+ function allOrNothingParseStringifyInterceptor ( value ) {
317
+ try {
318
+ value = getValue ( value ) ;
319
+ if ( isDefined ( value ) ) {
320
+ value = stringify ( value ) ;
321
+ }
322
+ return value ;
323
+ } catch ( err ) {
324
+ var newErr = $interpolateMinErr ( 'interr' , "Can't interpolate: {0}\n{1}" , text ,
325
+ err . toString ( ) ) ;
326
+ $exceptionHandler ( newErr ) ;
327
+ }
328
+ }
311
329
}
312
330
313
331
0 commit comments