ASP未在@ ko.Apply(Model)中定义

时间:2014-10-30 10:30:19

标签: asp.net-mvc knockout.js knockout-mvc

我试图绑定我的模型并得到错误 未捕获的ReferenceError:无法处理绑定“value:function(){return ASP._Page_Views_Configuration_Index_cshtml.Model()。SomeProperty}” 消息:ASP未定义

查看:

@using PerpetuumSoft.Knockout

@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/knockout")

@model Asteros.MKD.Controllers.SomeModel
@{
    var ko = Html.CreateKnockoutContext();
}

@ko.Html.TextBox(model => Model.SomeProperty)


@ko.Apply(Model)

束:

            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                    "~/Scripts/jquery-{version}.js"));

...

bundles.Add(new ScriptBundle("~/bundles/knockout").Include(
                "~/Scripts/knockout-{version}.js",
                "~/Scripts/knockout.mapping-latest.js",
                "~/Scripts/perpetuum.knockout.js"
                ));

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

使用model代替Model

@ko.Html.TextBox(model => model.SomeProperty)