Another Intro to Angular
I’ve heard some pretty cool stuff about Angular– people seem to like it. MVC(ish) on the front end? Sounds awesome! Too bad the only thing I’ve done with it is make a todo list. There are a couple different types of parts in an angular application:
Each of these serve a different purpose, and can fulfill different roles throughout your application. Controllers manage actions like network requests, business logic for displaying elements, serving as an abstraction layer on top of other services, etc. whereas services are often used for managing data since they are singletons and only created once. Directives, on the other hand, are predominantly used for creating smaller, more isolated and testable components in your application. Factories are a bit of an outlier because they behave very similarly to services, however they’re really supposed to be used, as the name implies, as factories that create other objects similar to constructor functions in standard JS.
This can be done relatively simply by setting various
ui-views in your markup! eg.
and then with your UI router you can do something like
This can make adding functionality like a sidebar or floating overlay both extremely easy and modular. Woohoo! Now combine this with using directives, controllers, services, and factories and you have yourself a fully fledged application!
I like to make stuff