BeautifulTrouble / beautiful-rising

The genetic code for the Beautiful Rising platform.
https://beautifulrising.org/
5 stars 0 forks source link

Module cross-references reload entire app. #30

Closed adrian-the-git closed 8 years ago

adrian-the-git commented 8 years ago

Links created with markdown are standard <a> tags which cause browsers to reload. Need a way to hook them and call router.navigate() (within the reasonable bounds of angular's "don't touch the dom yourself unless you absolutely have to" guiding principle)...

phillipadsmith commented 8 years ago

Links created with markdown are standard tags which cause browsers to reload.

Curious why that's a "bad thing(tm)" ...? It's part of how the web works, no?

Need a way to hook them and call router.navigate() (within the reasonable bounds of angular's "don't touch the dom yourself unless you absolutely have to" guiding principle)...

Capture any click events on anchors and check to see if they're linking to a route?

adrian-the-git commented 8 years ago

Bad thing because the page load is fairly heavy. Capturing events is non-intuitive afaict, still looking into it

phillipadsmith commented 8 years ago

Bad thing because the page load is fairly heavy.

Should mostly be cached after first load, no?

Capturing events is non-intuitive afaict, still looking into it

In Angular, or in general?

adrian-the-git commented 8 years ago

Should mostly be cached after first load, no?

It'll be quicker when all the js is bundled, but it's currently the difference between a half-second page load and a six-second page load. It also inserts an extra entry into the history api so the back button requires two clicks.

In Angular, or in general?

In Angular. I can do it, but it's sloppy as there's no obvious "everything's ready" hook. The change detector is always running and makes no distinction between the various stages of readiness. There's a hook called ngAfterViewChecked which seems to fire once for each successive template action which may have had side effects that need to be re-integrated into the view—so it'll fire something like fifteen times as the view is being rendered. My only concern is that the sloppy solution will slow everything down on creaky mobile devices but we'll see.