I have a HTML element bound to one of observables in my view model that is build with John Resig's simple javascript inheritance.
<div data-bind="with: selectedItem()">
    ...
    <div  data-bind="click: $root.save">Save changes</div>
    ...
</div>
My ViewModel looks like this.
var ViewModel = Class.extend({
    init: function(type){
        this.type = type;
        this.selectedItem = ko.observable({name: "My name"});
    },
    save: function(data){
        alert(this.type);
    }
});
The "this" in the ViewModel#save references to "selectedItem()". In other words, "this" references to "data" passed into the function. How can I access to the instance of ViewModel, instead?
Edited
The intention here is to inherit functions from ViewModel. I would like to access "this.type" as "first" and "second" respectively.
var FirstViewModel = ViewModel.extend({
    init : function() {
    this._super('first');
    }
});
var SecondViewModel = ViewModel.extend({
    init : function() {
    this._super('second');
    }
});
 
     
    