목록validate (1)
반응형
반응형
Eungene's Imaginations...
[Backbone.js] Model attribute validate(모델 속성 조건부 정의)
var Book = Backbone.Model.extend({ initialize: function () { this.on("invalid", function (model, error) { console.log("**Validation Error : " + error + "**"); }); this.on("change", function (a) { // 로그를 남기는 여러가지 방법 console.log('Model Changed'); if (this.hasChanged('name')) { console.log('The name has changed'); } if (this.hasChanged('author')) { console.log('The author has changed'); } console.l..
Programming/Backbone.js
2015. 10. 5. 10:29