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.

what happened to ng-bind-attr? #1925

Closed
Closed
@lanterndev

Description

@lanterndev

I need to write something like

<svg>
  <circle ng-bind-attr="{cx: cx, cy: cy, r: r}"></circle>
</svg>

because if I instead write

<svg>
  <circle cx="{{cx}}" cy="{{cy}}" r="{{r}}"></circle>
</svg>

the browser throws errors like

Error: Invalid value for <circle> attribute cx="{{ cx }}"

because Angular has not yet replaced the values of these attributes by the time the element is parsed.

It looks like Angular used to have ng-bind-attr which would solve exactly this problem, but it was taken out in 5502 / https://github.com/angular/angular.js/blob/master/CHANGELOG.md#100rc3-barefoot-telepathy-2012-03-29 and I have been unable to find any documentation of why it was taken out and what you're supposed to use instead. Can anyone shed some light on this?

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