knockout.js - Knockout observable variable not changing its value on click -
I do not know why my My code was posted here: Your Try: } currentTitle is not changing on click
viewModel = {article: ko.observableArray ([{id: 1, title: "Article One", Content: "Content for an article."}, {ID: 2, Title: "Article two" Content: "Content for article two."}, {ID: 3, title: "Article three", content: "Content for article three."}})), Currenttitle: korseous ("old")} ; & Lt; Div data-bind = "foreach: viewModel.articles ()" & gt; & Lt; div data-bind = "text: title, click: getTitle" & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; div data-bound = "text: visualmodel.crtitle" & gt; & Lt; / Div & gt; getTitle = function () {viewModel.currentTitle = "title"; } Ko.applyBindings (viewModel);
getTitle
getTitle = function () {viewModel.currentTitle ("title");
Comments
Post a Comment