NGCS - hello world with Angular

Hello world with AngularJS and CoffeScripe

by Krzysztof Safjanowski

HTML

<div ng-controller='app as app'>
  <div hello-world='app.world'></div>
</div>

CoffeeScript

angular
  .module('app', [])
  .controller('app', ->
    @world = 'world'
  ).directive('helloWorld', ->
    return {
      restrict: 'A'
      scope:
        world: '=helloWorld'
      link: (scope, element, attrs) ->
        element.text "Hello #{scope.world}"
    }
  )
        

angular.bootstrap document, ["app"]