Skip to content

Commit

Permalink
Adding fallback for options
Browse files Browse the repository at this point in the history
  • Loading branch information
tracend committed Nov 11, 2012
1 parent fe36a64 commit 2b15c95
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/app.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
Template = Backbone.Model.extend({
initialize: function(html, options){
_.bindAll(this, 'fetch','parse');
// fallback for options
options || (options={});
if( !_.isEmpty(html) ){
this.set( "default", this.compile( html ) );
this.trigger("loaded");
}
//if( !_.isUndefined( options.url ) && !_.isEmpty( options.url ) ){
if( options.url ){
this.url = options.url;
this.fetch();
Expand Down

0 comments on commit 2b15c95

Please sign in to comment.