Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to data-bind an iframe src attribute?

Is there a way to data bind the src attribute of an iframe with knockout to an item in my modelView? This...

<iframe data-bind="src: BioLink" width="100%" height="300">
<p>Your browser does not support iframes.</p>
</iframe>

...didn't do the trick.

like image 701
Tyler DeWitt Avatar asked Nov 16 '11 16:11

Tyler DeWitt


1 Answers

Use the attr binding, like this:

<iframe data-bind="attr: {src: BioLink}" width="100%" height="300">
<p>Your browser does not support iframes.</p>
</iframe>
like image 155
Tyler DeWitt Avatar answered Oct 08 '22 00:10

Tyler DeWitt