Open matths opened 11 years ago
I hate to answer to myself, but if I change the code to this, it works:
$('.template1').render({moreLinkXXX: 'http://www.somethi.ng'}, {
moreLink: {
href: function () { return this.moreLinkXXX; }
}
});
But is there a way to do it without that change to either model keys or data-bind keys? Is there a way to return the former value inside the method of the directives?
In your example above if you log the arguments passed to the callbacks, the former/current value is indeed passed in arguments[0].value.
$('.template1').render({moreLinkXXX: 'http://www.somethi.ng'}, { moreLink: { href: function () { console.log(arguments); return this.moreLinkXXX; } } });
So this might be not an issue, but maybe just not so well documented.
I would like to have a directive to fill stuff into an href="" attribute of an element, but not changing the text/html content of that html tag. In my example "read more…" should be left untouched. What's the way to do this?