Modify and Call Custom Binding In Knockout.js Explicitly

喜你入骨 提交于 2019-12-13 05:49:57

问题


Can I call the custom binding called form from another custom binding called addAnother explicitly? Also can I modify the parameters going into the parent custom binding?

    ko.bindingHandlers.addAnother = {
        init: function (element, valueAccessor) {
            $(element).click(function () {
                //$(element).parents('form')....
            });
        }
    };

<form class="box clearfix" action="@Request.RawUrl" data-bind="form:{ id: @Model.Division.Id }">
    @Html.Partial("EditorTemplates/Division", Model.Division)
    <div class="control-group">
        <div class="controls">
            @Html.Partial("EditorTemplates/Button")
            <button class="btn btn-inverse" data-bind="addAnother: { }"><i class="icon-save icon-white"></i> Save +</button>

        </div>
    </div>
</form>

来源:https://stackoverflow.com/questions/17732572/modify-and-call-custom-binding-in-knockout-js-explicitly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!