AngularJS Bind Attribute Presence

Posted by Chuck on Stack Overflow See other posts from Stack Overflow or by Chuck
Published on 2012-10-21T21:16:43Z Indexed on 2012/10/21 23:00 UTC
Read the original article Hit count: 175

Filed under:
|

I want to bind the presence of an attribute to a variable in AngularJS. Specifically, sandbox for an iframe. Say I have $myCtrl.allowJavascript as a variable, I want to do:

<iframe src="..." sandbox />

Where the sandbox attribute is present when allowJavascript == false, and I want the sandbox attribute to disappear when allowJavascript == true.

Does AngularJS have a mechanism for this?

The closest thing I could find was here, which basically says "it will just work for certain attributes"--but not for sandbox.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about angularjs