摘要: 1.Uncaught TypeError: undefined is not a function情景描述:function test(){this.num=1;};$(function(){ var test=new test(); // 当这条语句执行时,一开始var test定义为undefined类型,当执行到new test()报错检查到test为一个function,语句报错,此次变量不能使用和function test同名的test名变量,将变量改名为_test或其他});2.Uncaught TypeError: Cannot call method 'push' 阅读全文
posted @ 2012-08-19 23:15 露水丛生 阅读(3381) 评论(0) 推荐(1) 编辑
摘要: 翻译原文:http://www.knockmeout.net/2012/05/quick-tip-skip-binding.html问题:如何在一个页面中绑定多个view models。通常的做法是通过调用ko.applyBindings(vm,containerNode)方法将view model 绑定到特定的根元素节点上,然而,这种方法的限制在于当你需要邦定多个view model时,这些已使用过的容器元素(containerNode)不能被再次使用。意味着你不能嵌套绑定viewmodel。解决这个问题的一个方法是定义一个顶级viewmodel来容纳其所有的“sub” view model 阅读全文
posted @ 2012-08-19 20:08 露水丛生 阅读(1139) 评论(0) 推荐(0) 编辑