Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Angular.js for beginners

Angular.js for beginners

Presentation for Angular.js workshop 17.08.2014

Avatar for Basia Madej

Basia Madej

August 22, 2014
Tweet

More Decks by Basia Madej

Other Decks in Technology

Transcript

  1. JavaScript • programming language • most commonly used as part

    of web browsers • allows client-side scripts to interact with the user, control the browser, communicate asynchronously, and alter the document content that is displayed source: http://pl.wikipedia.org/wiki/JavaScript
  2. jQuery vs vanilla JavaScript // jQuery $.post('//example.com', { username: username

    }, function (data) { // code }); // Vanilla var httpRequest = new XMLHttpRequest(); httpRequest.onreadystatechange = function (data) { // code } httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); httpRequest.open('POST', url); httpRequest.send('username=' + encodeURIComponent(username)); source: https://gist.github.com/liamcurry/2597326
  3. Cool things about Angular • directives • two-way data bindings

    • Model-View-Controller • modules • jQLite • history
  4. Directive “At a high level, directives are markers on a

    DOM element (such as an attribute, element name, comment or CSS class) that tell AngularJS's HTML compiler ($compile) to attach a specified behavior to that DOM element or even transform the DOM element and its children.” Cool way to extend HTML easily by simply adding attributes, elements or comments. source: https://docs.angularjs.org/
  5. Basic direcitves • ngApp • ngModel • ngBind • ngIf

    • ngRepeat • ……. • …….
  6. Two-Way Data Binding Automatic synchronization of data between the model

    and view components source: https://docs.angularjs.org/
  7. Part 0 1. Open tasks/part0/index.html 2. Add missing code to

    enable angular on this page 3. Display the value of text input in 'greeting' header
  8. Part 1 1. Open tasks/part1/index.html 2. Add at least one

    superhero, then display all of the 3. Enable filtering superheros based on 'search' input
  9. Part2 1. Open tasks/part2/superheros_controller.js 2. Open tasks/part2/index.html 3. Add missing

    code to display list of superheros 4. Add more superheros to SuperherosController 5. Display information about superpowers 6. Use form to add more superheros
  10. Module • container • to keep code clear • to

    keep code separated • to easily include all need parts
  11. Part3 1. Open tasks/part3/index.html 2. Add 'ui.bootstrap' to superheroApp 3.

    Make sure we only display image when hero.image is present 4. Run 'showBigImage' on click