This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
ngSanitize linky filter throws error if text
is truthy but not a string
#13547
Milestone
Comments
gkalpak
added a commit
to gkalpak/angular.js
that referenced
this issue
Dec 15, 2015
gkalpak
added a commit
to gkalpak/angular.js
that referenced
this issue
Jan 6, 2016
BREAKING CHANGE: Before this change, the filter assumed that the input (if not falsy) was of type 'string' and that certain methods (such as `.match()`) would be available on it. This would most likely result in an not-very-useful error being thrown (trying to call a method that does not exist) or in unexpected behavior (if the input happened to have the assumed methods). After this change, a proper (informative) error will be thrown. If you want to pass non-string values through `linky`, you need to explicitly convert them to strings first. Closes angular#13547
gkalpak
added a commit
to gkalpak/angular.js
that referenced
this issue
Jan 6, 2016
BREAKING CHANGE: Before this change, the filter assumed that the input (if not falsy) was of type 'string' and that certain methods (such as `.match()`) would be available on it. This would most likely result in an not-very-useful error being thrown (trying to call a method that does not exist) or in unexpected behavior (if the input happened to have the assumed methods). After this change, a proper (informative) error will be thrown. If you want to pass non-string values through `linky`, you need to explicitly convert them to strings first. Closes angular#13547
gkalpak
added a commit
to gkalpak/angular.js
that referenced
this issue
Jan 7, 2016
BREAKING CHANGE: Before this change, the filter assumed that the input (if not undefined/null) was of type 'string' and that certain methods (such as `.match()`) would be available on it. Passing a non-string value would most likely result in a not-very-useful error being thrown (trying to call a method that does not exist) or in unexpected behavior (if the input happened to have the assumed methods). After this change, a proper (informative) error will be thrown. If you want to pass non-string values through `linky`, you need to explicitly convert them to strings first. Since input values could be initialized asynchronously, `undefined` or `null` will still be returned unchanged (without throwing an error). Closes angular#13547
gkalpak
added a commit
to gkalpak/angular.js
that referenced
this issue
Jan 8, 2016
BREAKING CHANGE: Before this change, the filter assumed that the input (if not undefined/null) was of type 'string' and that certain methods (such as `.match()`) would be available on it. Passing a non-string value would most likely result in a not-very-useful error being thrown (trying to call a method that does not exist) or in unexpected behavior (if the input happened to have the assumed methods). After this change, a proper (informative) error will be thrown. If you want to pass non-string values through `linky`, you need to explicitly convert them to strings first. Since input values could be initialized asynchronously, `undefined` or `null` will still be returned unchanged (without throwing an error). Closes angular#13547
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
http://jsfiddle.net/an710xcL/16/
Stacktrace thrown in that fiddle:
If looping an array or dictionary and linkying each value, it would be nice if mixed types didn't fail.
A simple workaround for now is to cast before passing to linky, e.g:
The text was updated successfully, but these errors were encountered: