Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 590e57a

Browse files
committed
WIP: move stringify around
1 parent dcaea5f commit 590e57a

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

src/ng/interpolate.js

+19-18
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,32 @@ function $InterpolateProvider() {
174174

175175
var lastValues = [];
176176
var lastResult;
177+
177178
var compute = function(values) {
178179
for(var i = 0, ii = expressions.length; i < ii; i++) {
179180
concat[2*i] = separators[i];
180-
concat[(2*i)+1] = stringify(values[i]);
181+
concat[(2*i)+1] = values[i];
181182
}
182183
concat[2*ii] = separators[ii];
183184
return concat.join('');
184185
};
185186

187+
var stringify = function (value) {
188+
if (trustedContext) {
189+
value = $sce.getTrusted(trustedContext, value);
190+
} else {
191+
value = $sce.valueOf(value);
192+
}
193+
194+
if (value === null || isUndefined(value)) {
195+
value = '';
196+
} else if (typeof value != 'string') {
197+
value = toJson(value);
198+
}
199+
200+
return value;
201+
};
202+
186203
return extend(function interpolationFn(context) {
187204
var i = 0;
188205
var ii = expressions.length;
@@ -192,7 +209,7 @@ function $InterpolateProvider() {
192209

193210
try {
194211
for (; i < ii; i++) {
195-
val = parseFns[i](context);
212+
val = stringify(parseFns[i](context));
196213
if (val !== lastValues[i]) {
197214
inputsChanged = true;
198215
}
@@ -217,22 +234,6 @@ function $InterpolateProvider() {
217234
expressions: expressions
218235
});
219236
}
220-
221-
function stringify(value) {
222-
if (trustedContext) {
223-
value = $sce.getTrusted(trustedContext, value);
224-
} else {
225-
value = $sce.valueOf(value);
226-
}
227-
228-
if (value === null || isUndefined(value)) {
229-
value = '';
230-
} else if (typeof value != 'string') {
231-
value = toJson(value);
232-
}
233-
234-
return value;
235-
}
236237
}
237238

238239

0 commit comments

Comments
 (0)