我有一个具有以下属性的viewmodel:
#Take difference
TIME_diff<-secondfile$TIME-firstfile$TIME
#Remove previous TIME variable then add first difference
firstfile$TIME<-NULL
firstfile$TIME<-TIME_diff
#Now row bind to previous dataset
data<-rbind(data, first file)
#And graph
ggplot(data2, aes(as.factor(NUMBER), TIME, fill = GROUP)) +
geom_bar(stat="identity", position = "dodge") +
xlab("NUMBER")+ylab("Iteration vs Recursion")
该列表是从这个POCO类创建的:
public class CompanyDetailsViewModel
{
[Required(ErrorMessage = "A Company Name is required")]
[Display(Name = "Company Name:")]
[StringLength(100)]
public string CompanyName { get; set; }
...
public IList<SuburbAndPostcode> SuburbAndPostcodesList { get; set; }
}
这是状态对象:
public class SuburbAndPostcode
{
[Key]
public int SuburbsAndPostcodesId { get; set; }
public string Suburb { get; set; }
public string PostCode { get; set; }
public State State { get; set; }
}
我正在尝试使用郊区和邮政编码属性创建一个变量作为列表,我可以将其用于自动完成功能但是我似乎无法将Model.SuburbsAndPostCodesList分配给变量。
我在此论坛上尝试了其他问题所指示的各种javascript选项,例如here。
我想有一个代表列表的javascript变量,我尝试过设置:
public class State
{
[Key]
public int StateId { get; set; }
public string ShortName { get; set; }
public string Name { get; set; }
public virtual ICollection<CompanyDetail> CompanyDetails { get; set; }
}
我尝试过使用json,我尝试在模型中循环但是得到一个错误,说变量&#34; test&#34;脱离背景:
var suburbs = @Model.SuburbAndPostcodesList
我也尝试过使用&#34; push&#34;和&#34; .Encode&#34;。
我想知道如何将这个字符串和状态对象列表分配给一个javascript变量?