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

ngBindHtml does not work if SafeHtml types don't have a toString function #14526

Closed
@mprobst

Description

@mprobst

If you have a $sce service whose objects do not return their value in toString, ngBindHtml will never receive updates because it relies on the toString value for change detection. That's pretty common because toString by default just returns [object Object], and for optimized binaries your optimizer might strip a toString method.

Using toString in ngBindHtml is overall a bit hacky, it runs counter to AngularJS' normal change detection. The fix is to just use a deep watch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions