Skip to main content

Menu

LEVEL 0
0/5 XP
HomeAboutTopicsPricingMy VaultStats

Categories

πŸ€– Artificial Intelligence
☁️ Cloud and Infrastructure
πŸ’Ύ Data and Databases
πŸ’Ό Professional Skills
🎯 Programming and Development
πŸ”’ Security and Networking
πŸ“š Specialized Topics
HomeAboutTopicsPricingMy VaultStats
LEVEL 0
0/5 XP
GitHub
Β© 2026 CheatGridβ„’. All rights reserved.
Privacy PolicyTerms of UseAboutContact

AngularJS Cheat Sheet

AngularJS Cheat Sheet

Back to Web Development
Updated 2026-04-28
Next Topic: Astro Web Framework Cheat Sheet

AngularJS (Angular 1.x) is a JavaScript-based structural framework developed by Google for building dynamic single-page applications (SPAs). It extends HTML's syntax with directives and enables two-way data binding between models and views, allowing the DOM to update automatically when data changes. AngularJS 1.8.3 (released December 2021) is the final official version, having reached end-of-life on December 31, 2021, yet it remains widely encountered in legacy codebases. Understanding AngularJS's declarative approach β€” where you describe what the UI should do rather than how to manipulate the DOM β€” is crucial for maintaining existing applications and recognizing the patterns that influenced modern frameworks.

What This Cheat Sheet Covers

This topic spans 19 focused tables and 204 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.

Table 1: Core Directives - Data Binding and DisplayTable 2: Core Directives - Event HandlingTable 3: Application StructureTable 4: Dependency InjectionTable 5: Services and ProvidersTable 6: Built-in ServicesTable 7: Scope Methods and WatchersTable 8: FiltersTable 9: Form ValidationTable 10: HTTP and PromisesTable 11: Routing with ngRouteTable 12: Routing with UI-RouterTable 13: Custom Directives - Definition OptionsTable 14: Directive Scope BindingsTable 15: Component Lifecycle Hooks (Angular 1.5+)Table 16: Animation with ngAnimateTable 17: SecurityTable 18: Testing ConceptsTable 19: Advanced Patterns and Utilities

Table 1: Core Directives - Data Binding and Display

DirectiveExampleDescription
ng-model
<input ng-model="username">
β€’ Binds input, select, or textarea value to a scope property
β€’ enables two-way data binding where changes in view update model and vice versa
ng-bind
<span ng-bind="message"></span>
β€’ One-way binds scope expression to element's text content
β€’ faster initial render than {{ }} interpolation as it avoids brief flash of uncompiled markup
ng-bind-html
<div ng-bind-html="trustedHtml"></div>
β€’ Binds and renders HTML content from scope expression
β€’ requires ngSanitize module or $sce.trustAsHtml() to mark content safe
{{ }} interpolation
<h1>{{title}}</h1>
β€’ Embeds expressions directly in HTML
β€’ supports filters and one-time binding with {{::expression}} prefix
ng-repeat
<li ng-repeat="item in items">
{{item.name}}
</li>
β€’ Instantiates template once per item in collection
β€’ creates child scope for each iteration with $index, $first, $last, $even, $odd properties
ng-options
<select ng-model="sel"
ng-options="x.name for x in items">
</select>
β€’ Dynamically generates <option> elements for a <select> from array or object
β€’ more efficient than ng-repeat on <option>
ng-if
<div ng-if="isVisible">
Content
</div>
β€’ Adds or removes element from DOM based on expression
β€’ creates new scope when true; better performance for heavy conditional content than ng-show
ng-show
<p ng-show="isActive">Text</p>
β€’ Shows or hides element by adding/removing .ng-hide CSS class (display: none)
β€’ element remains in DOM; faster toggling than ng-if
ng-hide
<p ng-hide="isHidden">Text</p>
β€’ Hides or shows element
β€’ inverse of ng-show; applies .ng-hide when expression is true
ng-switch
<div ng-switch="status">
<p ng-switch-when="active">Active</p>
<p ng-switch-default>Other</p>
</div>
β€’ Conditionally swaps DOM structure based on expression
β€’ uses ng-switch-when for cases and ng-switch-default for fallback
ng-pluralize
<ng-pluralize count="itemCount"
when="{'0':'No items','1':'1 item','other':'{} items'}">
</ng-pluralize>
Displays locale-aware plural message based on numeric count using en-US pluralization rules

More in Web Development

  • Astro Web Framework Cheat Sheet
  • Bootstrap CSS Framework Cheat Sheet
  • CSS Grid Layout Cheat Sheet
  • HTTPS Cheat Sheet
  • Responsive Web Design Cheat Sheet
  • Tailwind CSS Framework Cheat Sheet
View all 43 topics in Web Development