This document provides an overview of Angular, including what it is, why it is useful, its key features, and how to get started using it. Angular is a client-side framework written in JavaScript that makes it easy to build dynamic web applications. It provides features like separation of concerns, Ajax services, dependency injection, and browser history out of the box. The document demonstrates how to set up an Angular application and introduces concepts like views, directives, data binding, controllers, scopes, modules, and providers to help structure applications. It also covers validation and animation in Angular.
13. Make Your Code
Modular Buddy!
Keep the global namespace clean. Make testing guys life easier.
Make sharing of code between applications easier. Allow your
app to load different parts of the code in any order
15. Providers that makes
your code clean
Use value, factory, service, provider, contant to separate
business logic from the controllers. Increase reusability and
introduce a unit of work.
16. Value
Let's say that we want to have a
very simple service called
"clientId" that provides a string
representing an authentication id
used for some remote API. You
would define it like this:
17. Factory
Since Factory is more powerful
version of the Value recipe, you
can construct the same service
with it. Using our previous clientId
Value recipe example, we can
rewrite it as a Factory recipe like
this:
18. Service
The Service recipe produces a
service just like the Value or
Factory, but it does so by invoking
a constructor with the new
operator. The constructor can take
zero or more arguments, which
represent dependencies needed
by the instance of this type.