Skip to main content

Menu

LEVEL 0
0/5 XP
HomeAboutTopicsPricingMy VaultStatsPractice TestsCertifications

Categories

🎓 Certifications
🤖 Artificial Intelligence
☁️ Cloud and Infrastructure
💾 Data and Databases
💼 Professional Skills
🎯 Programming and Development
🔒 Security and Networking
📚 Specialized Topics
CheatGrid
HomeAboutTopicsPricingMy VaultStatsPractice TestsCertifications
LVLEVEL 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

These are the directives you reach for constantly — they connect your data to the DOM and decide what shows up on screen. From ng-model's two-way binding to the conditionals (ng-if, ng-show, ng-switch) and the repeaters (ng-repeat, ng-options), this is the everyday vocabulary of declarative templating in AngularJS, where you describe the result and let the framework keep the view in sync as data changes.

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
  • Django Cheat Sheet
  • NextJS Cheat Sheet
  • Sass and CSS Preprocessors Cheat Sheet
  • TanStack Libraries for Web Development Cheat Sheet
View all 42 topics in Web Development