Using KnockoutJS, how can I remove an item from an observable array? I want to be able to click on the listitem, and remove the item from the array (and thereby the list).
When you call a method from the child, this will be set to the child rather than $parent.
There are many ways to ensure that removeExpertise is called with the appropriate value for this. An easy way is to use .bind.
It would look like:
this.removeExpertise = function (expertise) {
this.expertise.remove(expertise);
}.bind(this);
Also, you will want expertise to be an observableArray rather than an observable, as an observableArray exposes array manipulation methods including a remove function.