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

Angular Directives For The Rest Of Us

Angular Directives For The Rest Of Us

A very basic introduction to directives. Talk at the Angular Meetup Berlin, April 9th 2014

Rin Raeuber

April 09, 2014
Tweet

More Decks by Rin Raeuber

Other Decks in Programming

Transcript

  1. Angular is what HTML would have been, had it been

    designed for building web-apps
  2. teach your browser new tricks ! add behavior to an

    element and/or transform the DOM Directives
  3. modifying the DOM function(scope, element, attrs){ // change the height

    of the element element.css(‘height’, ‘42px’); }
  4. changes to the scope that Angular doesn’t know about browser

    DOM events setTimeout asynchronous requests …
  5. changes to the scope that Angular doesn’t know about browser

    DOM events setTimeout asynchronous requests … ng-click $timeout $http
  6. install and configure Karma $ npm install -g karma $

    karma init run Karma karma start rejoice \o/ the setup
  7. describe(‘my thing', function(){ // some setup stuff ! it(“does something",

    function() { expect(result).toEqual(expectedResult); }); Jasmine specs
  8. … that directives are awesome ! … how to build

    one ! … how to manipulate the DOM and add event listeners in its link function ! … how to test a directive you hopefully learnt