I used the following syntax:
app = angular.module 'myapp', [] class MySimpleCtrl @$inject: ['$scope'] constructor: (@scope) -> @scope.demo = 'demo value' @scope.clearText = @clearText clearText: => @scope.demo = "" app.controller 'MySimpleCtrl', MySimpleCtrl angular.bootstrap document, ['myapp']
Take a look at this jsFiddle: http://jsfiddle.net/jwcMA/
UPDATE @ oto-brglez calling .bootstrap () replaces the presence of an ng application in the <html>
UPDATE @TylerCollier, this was a while ago, now I would probably use the controller as a notation (or maybe TypeScript!)
COFFEE
class PetController constructor: (@$scope) -> @pets = ['Fido','Felix'] addPet: (pet) -> @pets.push(pet)
HTML
<div ng-controller="PetController as pc"> ... <li ng-repeat="pet in pc.pets">
malix source share