mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-23 21:35:47 +00:00
fix(docs): handle the empty string in errorDisplay
This commit is contained in:
parent
705c9d95bc
commit
3c0c7165e2
2 changed files with 13 additions and 5 deletions
|
|
@ -65,4 +65,12 @@ describe("errorDisplay", function () {
|
||||||
elm = compileHTML('<div error-display="This {0} is {1} on {2}"></div>');
|
elm = compileHTML('<div error-display="This {0} is {1} on {2}"></div>');
|
||||||
expect(elm).toInterpolateTo('This Fooooo is {1} on {2}');
|
expect(elm).toInterpolateTo('This Fooooo is {1} on {2}');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should correctly handle the empty string as an interpolation parameter', function () {
|
||||||
|
var elm;
|
||||||
|
|
||||||
|
spyOn($location, 'search').andReturn({ p0: 'test', p1: '' });
|
||||||
|
elm = compileHTML('<div error-display="This {0} is a {1}"></div>');
|
||||||
|
expect(elm).toInterpolateTo('This test is a ');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -320,7 +320,7 @@ docsApp.directive.errorDisplay = ['$location', function ($location) {
|
||||||
formatArgs = [attrs.errorDisplay],
|
formatArgs = [attrs.errorDisplay],
|
||||||
i;
|
i;
|
||||||
|
|
||||||
for (i = 0; search['p'+i]; i++) {
|
for (i = 0; angular.isDefined(search['p'+i]); i++) {
|
||||||
formatArgs.push(search['p'+i]);
|
formatArgs.push(search['p'+i]);
|
||||||
}
|
}
|
||||||
element.text(interpolate.apply(null, formatArgs));
|
element.text(interpolate.apply(null, formatArgs));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue