# 12. Learn backbone.js tutorial from scratch for beginners(Part 15) More Model Events and listenTo ev

![](/files/-MS4CZFeT0GYX6hXsunH)

![](/files/-MS4DmdAZRGsYHdYmObI)

C:\Users\Administrator\Desktop\gulp\app.js

```
jQuery(document).ready(function($) {
  var FirstModel = Backbone.Model.extend({
    initialize: function() {
    	// this.bind('change',function(){
    	// 	console.log('bind change');
    	// });
    	this.bind('change:name',function(){
    		console.log('bind change');
    	});
    }
  });
  fmodel = new FirstModel({
  	
  });
  fmodel.set({
  	name: "Clone fmodel",
  	team: "Solution",
  	age: 10
  });
  var fmodel2 = fmodel.clone();
  var ModelView = Backbone.View.extend({
  	model: fmodel2,
  	initialize: function() {
  		this.render();
  	},
  	render: function() {	
  		console.log(this.model.toJSON());
  	},
  });
  vmodel = new ModelView();
});
```

![](/files/-MS4EVf6WjkJ3B6syw2z)

C:\Users\Administrator\Desktop\gulp\app.js

```
jQuery(document).ready(function($) {
  var FirstModel = Backbone.Model.extend({
    initialize: function() {
    	
    }
  });
  fmodel = new FirstModel({
  	
  });
  fmodel.set({
  	name: "Clone fmodel",
  	team: "Solution",
  	age: 10
  });
  var fmodel2 = fmodel.clone();
  var ModelView = Backbone.View.extend({
  	model: fmodel2,
  	initialize: function() {
  		this.render();
  	},
  	render: function() {	
  		fmodel2.set({
  			name: "Change name"
  		});
  		if(fmodel2.hasChanged()) {
  			console.log("hasChanged");
  		}else {
  			console.log("Not hasChanged");
  		}
  	},
  });
  vmodel = new ModelView();
});
```

![](/files/-MS4Ey54mSvm8l64lJWY)

C:\Users\Administrator\Desktop\gulp\app.js

```
jQuery(document).ready(function($) {
  var FirstModel = Backbone.Model.extend({
    initialize: function() {
    	
    }
  });
  fmodel = new FirstModel({
  	
  });
  fmodel.set({
  	name: "Clone fmodel",
  	team: "Solution",
  	age: 10
  });
  var fmodel2 = fmodel.clone();
  var ModelView = Backbone.View.extend({
  	model: fmodel2,
  	initialize: function() {
  		this.render();
  	},
  	render: function() {	
  		fmodel2.set({
  			name: "changedAttributes"
  		});
  		if(fmodel2.hasChanged()) {
  			console.log(fmodel2.changedAttributes());
  		}else {
  			console.log("Not hasChanged");
  		}
  	},
  });
  vmodel = new ModelView();
});
```

![](/files/-MS4FUsrrmI8kJiJUGZ0)

C:\Users\Administrator\Desktop\gulp\app.js

```
jQuery(document).ready(function($) {
  var FirstModel = Backbone.Model.extend({
    initialize: function() {
    	
    }
  });
  fmodel = new FirstModel({
  	
  });
  fmodel.set({
  	name: "Clone fmodel",
  	team: "Solution",
  	age: 10
  });
  var fmodel2 = fmodel.clone();
  var ModelView = Backbone.View.extend({
  	model: fmodel2,
  	initialize: function() {
  		this.render();
  	},
  	render: function() {	
  		fmodel2.set({
  			name: "changedAttributes"
  		});
  		if(fmodel2.hasChanged()) {
  			console.log(fmodel2.previous("name"));
  			console.log(fmodel2.previousAttributes("name"));
  			console.log(fmodel2.changedAttributes());
  		}else {
  			console.log("Not hasChanged");
  		}
  	},
  });
  vmodel = new ModelView();
});
```

![](/files/-MS4GzYoPrZRp9isdSbp)

C:\Users\Administrator\Desktop\gulp\app.js

```
jQuery(document).ready(function($) {
  var FirstModel = Backbone.Model.extend({
    initialize: function() {
    	
    }
  });
  fmodel = new FirstModel({
  	
  });
  fmodel.set({
  	name: "Clone fmodel",
  	team: "Solution",
  	age: 10
  });
  var ModelView = Backbone.View.extend({
  	model: fmodel,
  	initialize: function() {
  		this.render();
  	},
  	render: function() {	
  		this.listenTo(this.model, 'change',this.listenToModelChange);
  	},
  	listenToModelChange: function() {
  		console.log('listenToModelChange');
  	}
  });
  vmodel = new ModelView();
});
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://javascriptuse.gitbook.io/advanced/12.-learn-backbone.js-tutorial-from-scratch-for-beginners-part-15-more-model-events-and-listento-ev.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
