AngularJS Fundamentals - p-patel/software-engineer-knowledge-base GitHub Wiki

https://app.pluralsight.com/library/courses/angularjs-fundamentals/table-of-contents

ANGULAR CONTROLLERS & MARKUP

Demo: Controllers

  • add 'ng-app="eventsApp' attribute to html tag. indicates eventsApp is the module that runs this page

  • add 'ng-controller="EventsController"' attribute to div tag (this div is managed by this controller)

  • create js/controllers/EventController.js

    • parameters
      • controller name
      • function
  • add reference to controller script to html page

  • in controller managed div

    • add expressions to evaluate objects in the scope on html page
    • ng-src attribute (renders attribute after angular has rendered img path)

Displaying Repeating Info

  • add 'ng-repeat="session in event.sessions"' directive to a html element

Demo Handling Events

  • add 'ng-click="upVoteSession"' directive