jQuery would fit well here.
jQuery would fit well here.
onSomethingChanged() {
$('#foo').prop('disabled', true);
$('#spinner').removeClass('invisible');
$('#error-1').prop('hidden', true);
$('.buttons').hide();
if (value) {
$('#btn-2').show();
} else {
$('#btn-2').hide();
$('#btn-3').show();
}
// etc ...
}Round trips are just fine. Browsers are smart, servers are fast, and HTML compresses well. The site you're reading right now (HN) requires a reload. Stackoverflow requires a reload. Neither are slow to use.
If your page is really that complicated, then I suggest Vue or Preact which are efficient and designed to progressively enhance pages instead of rebuilding everything in JS.
Sites like HN and Stackoverflow have a vastly different audience than most bread-and-butter sites, and tackle different kind of issues.
If you really need a offline site then a simple service worker is all you need to cache the pages, not a big JS app.
You can write bad apps in any language and environment, similarly a site/app is not bad just because it's done in Y.
I would like to trade out AngularJS for Vue someday, though.
1. Render model from your JS object.
2. attach events
3. Change model
4. Go to step 1