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.

Using JSON in HTML attribute throws error #5296

Closed
@bbrewder

Description

@bbrewder

If you use JSON in an HTML attribute that is used in a '=' scope variable, it throws the error "[$rootScope:infdig] 10 $digest() iterations reached. Aborting!".

Here is a simple Plunker that shows the error.

http://plnkr.co/edit/B3NZSXbGsNyJec4PaFd4?p=preview

Everything seems to work fine except for this error (it seems to bind OK anyway). Just passing the attribute value as a string and calling scope.$eval within the link function seems to work, though I'm not sure if you would get 2-way data binding that way if the value was passed as an object instead of JSON.

The code should either be fixed to support inline JSON or a more explicit error should be thrown if JSON is being sent in from the attribute. If an error is thrown, it would be nice to include in the documentation on it what the work around is (scope.$eval?) and any limitations (2-way data binding broken?).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions