Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on The worst thing about CoffeeScript.
angular.module("blabla", []).directive "bla", ->
template: """ <div>Whatever<div ng-transclude></div></div></div> """ scope: true transclude: true restrict: "E" compile: (element, attributes) -> $input = element.find "input" for attr, value of attributes.$attr $input.attr value, attributes[attr] element[0].removeAttribute value
(scope, element, attributes) -> $input = element.find "input" # do something with $input # now $input is global to all directive and that sucks
angular.module("blabla", []).directive "bla", ->
template: """ <div>Whatever<div ng-transclude></div></div></div> """ scope: true transclude: true restrict: "E" compile: (element, attributes) -> $input = element.find "input" for attr, value of attributes.$attr $input.attr value, attributes[attr] element[0].removeAttribute value