I started playing around with CoffeeScript and AngularJS today and noticed that there is not a whole lot of documentation or examples on how to correctly write AngularJS using CoffeeScript. My own experimentation with it seems not to be working. As a pedagogical excersice, could someone point me as to why this is fiddle is not working?
http://jsfiddle.net/dralexmv/8km8x/4/
It claims the InventoryModule is not defined. Although I have declared it in the first line.
This is the HTML:
<div ng-app='InventoryModule' ng-controller='InventoryController'>
<table>
<tr ng-repeat='item in items'>
<td>{{item.title}}</td>
<td>{{item.price | currency}}</td>
</tr>
</table>
And this is the CoffeeScript:
inventoryModule = angular.module 'InventoryModule', []
inventoryModule.factory 'Items', ->
items = {}
items.query -> [
{title: 'Table', price: '5'},
{title: 'Chair', price: '10'}
]
items
inventoryModule.controller 'InventoryController', ($scope, Items) ->
$scope.items = Items.query