Frage

I'm newbie on using SpineJS and having happy time with it.

And, when I finished contact examples and saw some other components in SpineJS,

I realized there's no example about Web Site(which has many html pages).

It seems like SpineJS is not proper framework for web site design.

(I think this kind of framework is proper for Single Page Application)

I thought like that because I should create 'websocket' object in the first view of my web site.

I cannot keep the 'websocket' object when I leave first view( html page changed.).

I should keep this 'websocket' for whole time until user logs out.

Is it right? or are there ways that I can create multi view web site?

(AngularJS framework support this with $route service. - it can load html page without reloading whole framework.)

War es hilfreich?

Lösung

You can certainly implement multi-page websites within a single-page RIA. Ok, that sounds paradoxical. From the server side, it's rendering a single page, serving the source code. But within the client code, the Router object may render the page completely differently based on the route.

Edit / Addition:

Not sure if this is best, but here's how my app loads templates stored in separate html files within the app source code, e.g. myview.template = app.TemplateManager.fetch('grids/item');

  templateManager: {
    JST : {},   // hash table so not to load same template twice

    fetch: function(path) {
      url = "/app/templates" + path + ".html";

      if (!this.JST[path]) {
        $.ajax({ url: url, async: false }).then(function(contents) {
          this.JST[path] = _.template(contents);
        });
      } 

      return this.JST[path];
    }
  });
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top