I'm trying to understand the functionality of the "this" keyword and the self.model.get() method in this context. I have a line of code that I want to use for the "assc" variable in a .js file. How should I go about implementing this?
//var assc = _.find(self.model.get("associations"), { "associationName": data.associationName });
//below is a .cshtml file code snippet
function AssociationsViewModel(associations)
{
var self = this;
var ListPageSize = 5;
var associationInstancesPageSize = 6;
var currentAssociation = null;
}
self.onAddAssociationClicked = function (eventArgs, data)
{
var assc = _.find(self.model.get("associations"), { "associationName": data.associationName });
if (assc)
{
if (assc.isAddNewEnabled)
{
addInstanceToAssociation(self.model, assc);
}
}
}