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

ngSanitize throws TypeError when trying to use ng-bind-html w/ Number. #8416

Closed
chiefy opened this issue Jul 30, 2014 · 2 comments
Closed

ngSanitize throws TypeError when trying to use ng-bind-html w/ Number. #8416

chiefy opened this issue Jul 30, 2014 · 2 comments

Comments

@chiefy
Copy link

chiefy commented Jul 30, 2014

I'm not really sure if this is an issue, as I don't use ng-bind-html that much, but...

Just discovered this issue in our app running ng 1.1.5, but it seems to occur in the latest version of ngSanitize. When scoped var is set to a Number, it bombs out when ngSanitize tries to call indexOf on the Number, which is undefined.

ex. <div ng-bind-html="some_number"></div> <!-- throws error -->

jsbin example case

@caitp
Copy link
Contributor

caitp commented Jul 30, 2014

well I mean, I guess we could make sure that we're using a string, that doesn't seem unreasonable

@chiefy
Copy link
Author

chiefy commented Jul 30, 2014

👍 That's some quick service right there. Thanks.

caitp added a commit that referenced this issue Jul 30, 2014
Previously, $sanitize(nonString) would throw. Now, the type is converted to a string before any work
is done.

Closes #8417
Closes #8416
@caitp caitp closed this as completed in 34781f1 Jul 30, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants