...
TODO: add content here
Core concepts
Modules
- Advantages:
- Keeps our global namespace clean
- Eases writing tests as well as keeps them clean as easy to target isolated functionality
- Eases to share code between applications
- Allows different parts of the code to be loaded in any order
- Advantages:
Scopes
- Scopes objects that contain functionality and data to use when rendering the view. It is the single source of truth for all views. You can think of scopes as view models.
- Basic Functions
- They provide observers to watch for model changes
- They provide the ability to propagate model changes through the application as well as outside
the system to other components - They can be nested such that they can isolate functionality and model properties.
- They provide an execution environment in which expressions are evaluated.
Expressions
- Expressions are similar to like the result of an eval(javascript) (roughly). They are processed by Angular and, therefore, have these important, distinct properties:
- All expressions are executed in the context of the scope and have access to local $scope variables.
- They do not throw errors if an expression results in a TypeError or a ReferenceError.
- They do not allow for any control flow functions (conditionals; e.g., if/else).
- They can accept a filter and/or filter chains
Controllers
- The controller in AngularJS is a function that adds additional functionality to the scope of the view. They are used to set up an initial state and to add custom behavior to the scope object.
- To create custom actions we can call in our views, we can just create functions on the scope of the controller.
...
Data Binding
- Due to the nature of javascript itself and how it passes by value vs. reference, it's considered a best- practice in Angular to bind references in the views by an attribute on an object, rather than the raw object itself.
Controllers
- Create variables inside the controller to be explicit.
- It is considered a best-practice to name our controllers NameCtrl in camelcase.
- Keep controllers slim by using the dependency injection feature of AngularJS to access services.
Spreading route definitions among several modules
...