diff options
author | Thomas Davis <thomasalwyndavis@gmail.com> | 2015-06-13 01:10:15 +1000 |
---|---|---|
committer | Thomas Davis <thomasalwyndavis@gmail.com> | 2015-06-13 01:10:15 +1000 |
commit | ded47587407e5ea0a30c4c1ef2fb969ba80a920a (patch) | |
tree | 21e969860dd5b7edf2b764b6d1d02c64dd911d6d | |
parent | a89e9763476afa770d6139ee65021a9cb4b04f40 (diff) | |
download | backbonetutorials-origin/gh-pages.zip backbonetutorials-origin/gh-pages.tar.gz backbonetutorials-origin/gh-pages.tar.bz2 |
Update 2011-01-29-what-is-a-model.mdHEADorigin/gh-pagesorigin/HEADgh-pages
-rw-r--r-- | _posts/2011-01-29-what-is-a-model.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/_posts/2011-01-29-what-is-a-model.md b/_posts/2011-01-29-what-is-a-model.md index e967b50..ad5ffd6 100644 --- a/_posts/2011-01-29-what-is-a-model.md +++ b/_posts/2011-01-29-what-is-a-model.md @@ -13,15 +13,15 @@ Across the internet the definition of [MVC](http://en.wikipedia.org/wiki/Model%E So for the purpose of the tutorial let's create a model. -{% highlight javascript %} - Person = Backbone.Model.extend({ +```js + var Person = Backbone.Model.extend({ initialize: function(){ alert("Welcome to this world"); } }); var person = new Person; -{% endhighlight %} +``` So _initialize()_ is triggered whenever you create a new instance of a model( models, collections and views work the same way ). You don't have to include it in your model declaration but you will find yourself using it more often than not. |