5 ms·
FWIW as someone who struggled early on with the "How do i use angular with <other technology that i work with>?" question. It's important to IMMEDIATELY unders
by dfsegoat 10y ago
FWIW as someone who struggled early on with the "How do i use angular with <other technology that i work with>?" question.
It's important to IMMEDIATELY understand that the backend should not matter - so long as it returns JSON (or even XML i suppose) which AngularJS 1.x can consume with $http or $resource (or ng 2.x equivalent).
This is an advantageous pattern in my opinion because the front-end angular application is totally decoupled from the backend (we have separate code repos - and even separate developers) - you can keep the backend as Go, or PHP, or Python - or even a static JSON file with something like jsonserver. So long as the JSON is formatted appropriately and API does what angular expects - angular does not care!
- thewhitetulip 10y agoThis is great advice! What do you think about routing? angular has it's own router, so can Go have. What to choose?
- dfsegoat 10y agoI can only tell you what I know from experience: We use angular as an MVW for front-end We use django + django-rest-framework for back-end. It's important to understand that "routing" in angular is a bit "synthetic" - it's not actually requesting much from the server after index.html loads (it only changes address etc as part of the routing). So the routing is totally separate on the front-end, assuming you are using a back-end to provide the data.
- DCoder 10y agoYou don't choose between those two routers, they are not replacements for each other. At the risk of stating the obvious, the Angular router handles routing for the Angular frontend, the Go router handles routing for the Go backend (the initial page load, the AJAX calls made from Angular to get data...).
- thewhitetulip 10y agoThanks!
- xeromal 10y agoYeah, the only technology weirdness that I ran into was CORS. Making angular and x technology play nice can be a bit fun sometimes.
- dfsegoat 10y agoYeah absolutely same here - I think we would have hit that regardless though whatever lib we used, as I think I recall the CORS stuff is all baked into the browser. So it was really just the growing pains of moving over to a SPA for us.