【发布时间】:2014-05-27 13:15:36
【问题描述】:
我正在构建一个 SPA,以此 article 为起点。 jsfiddle here
我正在尝试将此解决方案转换为基于此article 使用 sammyjs jsfiddlehere
我带着我的混搭小提琴here。
我面临的问题是单击链接时 Sammyjs 配置未被调用。不知道我哪里错了。
Sammy(function () {
this.get('#:section', function () {
//this.params.section-- need to see the section selected by using this
alert(this.params.section);//currently this is not working
//based on the selected section would like to update the selectedSection and apply the appropriate view models
//also a
//ko.applyBindings(settingsModel, document.getElementById("settings"));
//ko.applyBindings(notificationsModel, document.getElementById("notifications"));
});
}).run();
【问题讨论】:
-
你还需要添加 jquery: jsfiddle.net/TBzA5 然后你的代码工作正常。
-
感谢您发现错误。我在这里有点新人,为什么我的声誉下降了 2。
-
有人否决了这个问题
标签: knockout.js sammy.js