News for hackers. Stuff that matters.
Re:Synth – A Node.js web framework designed for AngularJS by bryanlarsen on Thursday June 12, 2014 @09:50AM (#7883345)
- Preload html view on page load (saving another extra roundtrip!)

does this mean it serves fully formed html like rendr[1] or highbrow[2]? I'm not sure what angular does, but all client-side apps I've seen, templates are compiled into javascript and concatenated onto the app code, so they're never an extra roundtrip.

1: https://github.com/rendrjs/rendr 2: https://github.com/wvl/highbrow

Re:Synth – A Node.js web framework designed for AngularJS by SDGT on Thursday June 12, 2014 @11:40AM (#7884029)
Depends on how you're using angular to inject views.

Vanilla angular views are requested, parsed, bindings added, and then presented. It's one request for the html, all the rest happens in browser.

angular ui views may be different, but according to my network panel on chrome its still one request for the template and whatever assets it brings with it.

I'm going to guess the guys meant they will preload the first view based on page state, which does indeed save a single round trip, but means nothing for any state changes that would occur after the fact. I would argue that an app which needs to micro optimize like this might not be built correctly from the get go, as you're really only saving 1 request and whatever small byte size of the content.

Re:Synth – A Node.js web framework designed for AngularJS by KaoruAoiShiho on Thursday June 12, 2014 @12:20PM (#7884291)
Your response to someone making an amazing optimization is if you need optimizations your app is done wrong... seriously?

You're seriously underestimating the difference this makes. If this is rendr for angular it is a breakthrough for the angular community.

Re:Synth – A Node.js web framework designed for AngularJS by benaiah on Thursday June 12, 2014 @01:28PM (#7884748)
That's not what he said. He said it probably wasn't rendr for angular. I'm pretty sure he's saying they preload the initial viewing template (not a prefilled template) based on app state - stuff like clientside routing and such. The browser still has to render the template, but it doesn't have to be fetched by a separate request.
Re:Synth – A Node.js web framework designed for AngularJS by KaoruAoiShiho on Thursday June 12, 2014 @01:47PM (#7884906)
That's true I don't see any examples of server side rendering though the developer says it works... https://github.com/JonAbrams/synth/issues/35
Re:Synth – A Node.js web framework designed for AngularJS by conradfr on Thursday June 12, 2014 @03:43PM (#7885568)
Personally with AngularJS I tend to embed multiple views with

<script type='text/ng-template' id='hackernews.html'> </script>

And you can call one view with your usual "templateUrl: 'hackernews.html'"

Especially if I have many directives with more than a few lines of html. That way you can embed them in your main html or in a separate cacheable file.