I'm about to give up on AngularJS, I'm going to try React
My implementation is pretty vanilla AngularJS with ui-router. All I want is for a user to use forward and back browser buttons to navigate. It doesn't work. I can't find a solution through searching Google. What few blog posts and StackOverflow questions I can find are from 2013 and 2014.
I'm not going to spend a week figuring out how all the internals work so I can roll my own solution.
If going to spend a week on something, it will be working with React. And, I'll see where that goes.
15 comments
[ 5.1 ms ] story [ 41.5 ms ] threadBefore you throw out everything, try this: https://docs.angularjs.org/guide/$location
I've been working through $location and state change events. I've read and worked through every blog post and stack exchange question from the first three pages of the "angularjs $location" Google search results for the last 36 hours.
The browser address bar was flickering so I was wondering why that happened. It wasn't my code but I found the culprit.
jsx is incredibly straightforward to read/write, and the actual time it takes to build anything is trivial, but if you drop a lot of es6 on it babel is going to output some moderately horrifying code when you dig into it.
Get your head around the component lifecycle stuff early and save yourself some O(n) heartache down the line.
https://github.com/AmpersandJS/ampersand-router
I've personally used this router with in a React SPA, though you can use it with pretty much anything including something simple like jQuery or Knockout. If you don't want to use a module loader, then grabbing the original Backbone router is probably your best bet.
This really shouldn't be hard to get working. Try downloading a sample/example project that has routing set up already then strip it down to the bare minimum. Throwing a whole framework away because you're maybe missing a line of code somewhere isn't going to set a good trend.
I tried to port an Angular 1 to Angular 2 recently and fixing issues to do with just getting the JavaScript modules/files to load drove me up the wall. I was close to giving up but after working through several layers of issues it eventually worked. Sounds like it was an similar experience to you...there's so many permutations of JavaScript stacks you can use that isolating the issue is like finding a needle in a haystack sometimes. What I mean is that sometimes all you can do it be persistent and realise that switching to a new framework could just introduce lots of new issues.
^_^
https://github.com/angular-ui/ui-router/blob/master/README.m...
The "Nested States & Views" section of the README links to a full working demo on Plunker that does exactly what you want:
http://plnkr.co/edit/u18KQc?p=preview