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.

$interpolate : add a way to hook string representation #7317

Closed
@jpolo

Description

@jpolo

$interpolate has only two behavior for stringify : IF string THEN output without change OR perform json conversion.
It would be helpful to add a detection for hookable toString behavior for objects that are always represented by string or number (= where json representation has no value at all).

Use case: when using custom Int64, URI, ..., objects, everybody would expect that {{myUri}} would display a string representation instead of a json representation or a quoted string.

Idea of implementations :

  • detect that valueOf or toString is overriden ?
  • add a callback in $interpolate module ?
  • apply toJson only for plain objects (i.e. where Object.getPrototypeOf(o) === Object.prototype) ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions