Roadmap › AngularJS (1.x) — Legacy › Module: Fundamentals
Lessons in this course (13)

2. Built-in directives

Basic★ Must knowLesson 2 of 13
DirectivePurpose
ng-appBootstraps the app
ng-controllerAttaches a controller
ng-modelTwo-way binding for inputs
ng-bind / {{ }}One-way output (ng-bind avoids flicker of {{ }}; ng-cloak hides until compiled)
ng-repeatLoop (track by for performance)
ng-ifAdds/removes DOM (creates a child scope)
ng-show / ng-hideToggles CSS display (element stays in DOM)
ng-switchSwitch-case rendering
ng-class, ng-styleDynamic classes/styles
ng-click, ng-change, ng-submit, ng-blurEvents
ng-includeInclude external HTML template
ng-optionsBuild <select> options
ng-disabled, ng-checked, ng-readonlyBoolean attributes
ng-form, ng-messagesForms and validation messages

ng-if vs ng-show: ng-if removes the element and its scope/watchers (cheaper when hidden, re-creates on show); ng-show only hides with CSS (watchers stay active, cheaper toggling).