bdo334
bdo334

Reputation: 408

Dynamic loading Backbone view with Requirejs

I'm using require.js with Backbone in ordrer to load my differents views.

In order to define the view I'm using this piece of script that is launched by my Router:

var view = require([
  'hbs!tpl/'+name,
   'views/'+name,
   data.path       
], function(Tpl,module,data){

       options.template = Tpl;
       options.data = data;
       return new module(options);
});    

The Backbone view receive the usefull options like the compiled template and the Model definition.

Is there a way to remove the script added by Require.js into the head tag when I remove my Backbone view ?

Upvotes: 0

Views: 367

Answers (1)

Simon Boudrias
Simon Boudrias

Reputation: 44649

Removing the script tag added by Require.js won't unload the javascript.

What I mean is that it is useless to remove this script tag. You just shouldn't care about this, it don't change anything to the way your page react.

Upvotes: 1

Related Questions