knockout.js Href binding Using attr binding


Example

<a data-bind="attr: { href: myUrl }">link with dynamic href</a>
ko.applyBindings({
  myUrl: ko.observable("http://www.stackoverflow.com")
});

Since there is no native href binding in KnockoutJS, you need to use a different feature to get dynamic links. The above example showcases the built-in attr binding to get a dynamic link.