Problem with AngularJS and CoffeeScript
May 18, 2013要用CoffeeScript請用標準的寫法去寫AngularJs
app = angular.module 'App', []
app.controller 'YourCtrl', ($scope) ->
# Write you code here ...
還有另外一種寫法是用CoffeeScript中的Class去初始化controller(應該是吧)
這種寫法我目前還看不太懂,要研究一下CoffeeScript的Class
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']