backbone 学习笔记

3种情况可以触发validate

  1. save() model 的时候
    person.save();
    console.log(person.validationError); //显示:年龄错误

  2. set property的时候强制检查,用{validate: true}
     person.set({
       age: 100
     },  {validate: true});
     console.log(person.validationError); //显示:年龄错误

  3. 调用isValid()手动检查
    person.isValid();

        console.log(person.validationError); //显示:年龄错误

 

另外如果有验证错误model会trigger特殊invalid事件,这样可以在有错误的时候才显示错误

person.on("invalid",function(model,error){
     console.log(error.validationError); //显示:年龄错误

});

 

 

fetch数据时,IE报304错误,解决办法:http://blog.sina.com.cn/s/blog_4b7809800100y1c3.html

this.commentList.fetch({
                url: "ax/comment/"+this.model.get("id"),
                data:{token: new Date().getTime()},
                success : function(data){
                    $(that.el).find(".comments").html(new CommentListView({model: data}).render().el);
                }
            });

 

http://www.ibm.com/developerworks/cn/web/0907_osgiweb_liuqing/

http://www.cnblogs.com/skyme/archive/2012/07/10/2583952.html

http://javascript.ruanyifeng.com/

http://fontawesome.io/

 

http://www.prepbootstrap.com/bootstrap-theme

 

http://coenraets.org/blog/2012/01/using-backbone-js-with-a-restful-java-back-end/

https://weblogs.java.net/blog/caroljmcdonald/archive/2013/09/16/example-backbonejs-jax-rs-jpa-application

https://code.google.com/p/crypto-js/#CryptoJS_3.1

http://blog.csdn.net/hf81970/article/details/13508231

http://www.teaching-materials.org/backbone/#/

https://github.com/jashkenas/backbone/wiki/Tutorials%2C-blog-posts-and-example-sites

https://github.com/addyosmani/backbone.paginator

https://github.com/alexanderscott/backbone-login

http://blog.42floors.com/user-authentication-with-rails-and-backbone-js/

restful ajax web app

http://thomasdavis.github.io/tutorial/making-a-restful-ajax-app.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值