4 ms·
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.
- niftich 10y agoThough I enjoy React, React (by itself) isn't a full MVC framework like Angular. Before you throw out everything, try this: https://docs.angularjs.org/guide/$location https://docs.angularjs.org/guide/$location
- 123456z 10y agoSounds like they might want to also start here: http://www.w3schools.com/html/html_links.asp http://www.w3schools.com/html/html_links.asp
- zappo2938 10y agoThis is actually a helpful comment. 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.
- calcsam 10y agoDo it! React is way better.
- 1_listerine_pls 10y ago?
- ry_ry 10y agoReact is a very nice UI view rendering lib, but that's pretty much all it does. Which isn't a bad thing at all, just something to bare in mind coming from Angular. 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.
- arisAlexis 10y agoIf you are going to spend a week in angular for routing you will spend a month in react cause react is a view rendering lib. Just read the docs and for for http://angular.io http://angular.io (angular2) they have a hands on example
- lastofus 10y agoIf all you really need is a router, you should probably just use a router: https://github.com/AmpersandJS/ampersand-router 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.
- seanwilson 10y ago> 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 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.
- zappo2938 10y agoAfter several hours I figured it out. My biggest problem was that I had the same sentiment as your comment in "because you're maybe missing a line of code." I kept blaming myself when it was a bug in a popular module one of only a handful I'm using.
- seanwilson 10y agoJust remember you're in good company! I find a lot of coding involves you trying to do something, getting an error, you look up the error, you try the solution you find, you get a new error and so on. Many people will give up after a few hurdles. 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.
- aprdm 10y agoVuejs is what you really want
- bwackwat 10y agoI personally recommend a vanilla front-end. Contact me for details. ^_^
- gordonzhu 10y agoDid you try reading the ui-router docs? https://github.com/angular-ui/ui-router/blob/master/README.md#nested-states--views 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 http://plnkr.co/edit/u18KQc?p=preview
- przeor 10y agoGood luck in React, there is a good learning material called "ReactJS Convention Book - ReactJS For Dummies: Why & How to Learn React Redux, the Right Way." - and it's 100% online at https://reactjs.co/ https://reactjs.co/