layout | title | permalink | feature-img | hide |
---|---|---|---|---|
page |
Angular Notes |
/angular/ |
img/feature_img_4.png |
true |
Angular is a JavaScript framework for building dynamic web applications.
- CRUD (Create, Read, Update, Delete)
- not suitable for static, content-heavy sites
- SPA: single-page applications
- do not require page loads when navigating between pages, like with most websites
- goal is a UX similar to desktop applications
- e.g. Gmail, Medium, Virgin America
- extend HTML syntax with directives
- directives attach particular behavior(s) to DOM elements
- Example:
<div ng-click="doSomething()">
- two-way data binding: automatic synchronization of data between model and view components
- Framework: provides basic structure of application; developer's code fills in details
- Library: a collection of prewritten code of common tasks to simplify development; developer's code provides structure for which the library provides details
- MVC (Model-View-Controller)
- Models - represent knowledge (HTML)
- Views - visual representations of models (CSS)
- Controllers - links between users and systems (browsers)
- MVVM (Model-View-ViewModel)
- ViewModel represents the View and exposes data objects from the Model
- ViewModel provides data binding between View and Model
- Angular started MVC but is becoming more MVVM
- Modules are containers for different parts of a web app
- Controllers
- Services
- Filters
- Directives
- Encapsulation: create functions locally within modules to avoid shadowing in the global scope Linters: tools that check code quality (e.g. JSHint)