I am encountering an error that says 'unexpected identifier' and I can't pinpoint the cause of it. This is how I declared 'myData'
var myData = {
Id: @Model.Id,
JobId: @Model.JobId,
ItemId: @Model.ItemId, //error on this line in console
ItemName: @Model.ItemName,
MFGNumber: @Model.MFGNumber,
Parts: partArray,
Components: componentArray,
ComponentParts: componentPartArray,
ComponentSubComps: componentSubCompsArray,
SubCompParts: subCompPartsArray,
SubCompSubComps: subCompSubCompsArray,
SubCompSubCompParts: subCompSubCompPartsArray
}
This is how my itemViewModel is structured
public class ItemViewModel
{
[Required]
public int Id { get; set; }
[Required]
public int JobId { get; set; }
public string ItemId { get; set; }
public string ItemName { get; set; }
public string MFGNumber { get; set; }
public IList<ItemPartViewModel> Parts { get; set; }
public IList<ItemComponentViewModel> Components{ get; set; }
public IList<ComponentPartViewModel> ComponentParts { get; set; }
public IList<ComponentSubCompViewModel> ComponentSubComps { get; set; }
public IList<SubCompPartViewModel> SubCompParts { get; set; }
public IList<SubCompSubCompViewModel> SubCompSubComps { get; set; }
public IList<SubCompSubCompPartViewModel> SubCompSubCompParts { get; set; }
}
This is the error displayed in the console
https://i.sstatic.net/cLQlj.png
Why is this error occurring? Removing the 'ItemID' field results in another 'unexpected identifier' issue at the end of my script. Any insights on what could be causing this problem with myData?