private static void AddAttibutes(StringBuilder sb, KOModel model) { foreach (var attribute in model.Attributes) { var line = "\tthis." + attribute.Key + ": " + KOUtils.WrapObservable(KOUtils.ToJavascriptValue(attribute.Value.Value), attribute.Value.Observable); line += ";"; sb.AppendLine(line); } }
private static void AddAttibutes(StringBuilder sb, KOModel model) { foreach (var attribute in model.Attributes) { var line = "\t" + attribute.Key + ": " + KOUtils.WrapObservable(KOUtils.ToJavascriptValue(attribute.Value.Value), attribute.Value.Observable); if (attribute.Key != model.Attributes.Last().Key || model.Objects.Any() || model.Arrays.Any()) { line += ", "; } sb.AppendLine(line); } }
private static string BuildArray(KeyValuePair <string, KOValue <dynamic> > observableArray) { var line = new StringBuilder(); var first = true; foreach (var item in observableArray.Value.Value) { if (!first) { line.AppendLine(", "); } line.Append(KOUtils.ToJavascriptValue(item)); first = false; } return(line.ToString()); }