How to set `href` on a link in Knockoutjs?

Asked

Viewed 136 times

2

I’m starting with Knockoutjs and would like to know if you have how to attach a link received by AJAX/JSON in a tag <a href="meu link aqui">Meu link</a>.

HTML:

<div data-bind="text: url"></div>

<hr/>

<a data-bind="href: url">Google</a>

Javascript:

function App() {
  this.url = "http://www.google.com/";
}

ko.applyBindings( new App() );

No Jsfiddle: http://jsfiddle.net/3V53L/

1 answer

2


  • Very simple. I need to read the documentation. =)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.