gogogadgetinternet gogogadgetinternet - 2 days ago 3
AngularJS Question

Definition the term "routing" used in angularJS tutorial?

In the below page near the top the writer does a good job of describing all the puzzle pieces Angular makes up in a web app, but there was just one that I wasn't able to find a good source of information on:


  • routing



Searches are tough - either revealing just some kind of framework or concep specific to a back-end or low level framework or language so I'm not sure about using these as an introduction. And/or they assume the user knows what all this entails before beginning. Is this a well known OOP concept or is it specific to javascript/front end development? If it's network routing, such as this (http://www.google.com/patents/US20030046422) I'd be happy to read through it, but I'm not sure if this is actually it. I'm having trouble finding a definitive answer - that includes all the things that make up "routing" especially clientside/with JS as I thought this was more of a backend/low level concept.

http://docs.angularjs.org/guide/overview

Everything you need to build a CRUD app in a cohesive set: data-binding, basic templating directives, form validation, routing, deep-linking, reusable components, dependency injection.

Answer

Routing in AngularJS (at least as far as I've understand) refers to the action of taking a URL in the browser, and mapping that to a controller and view.

For instance, you can set up that the url: /admin runs the AdminCtrl-controller and loads the view /partials/admin.html. When I say load view, I don't mean that the browser refreshes to the page /partials/admin.html, rather it loads it in the background (using AJAX I presume, or an IFrame, or some other means of acquiring it), and when it has the data it compiles it (as angular does with the page), and runs it against the scope given to the AdminCtrl-controller. It then inserts the result into any ng-view-directive on the page.