Question

I've created a small calculator and now with help have got it working the way I want in Javascript. When I try and convert this AngularJS to coffeescript I get this error:

Error: Argument 'CalcCtrl' is not a function, got undefined

The code is actually working but the error is showing up in the java console, is there a way to fix this?

Here is my JSFiddle: http://jsfiddle.net/YUza7/13/

Was it helpful?

Solution

You must remove the ng-app attribute since you use the manual bootstrap:

http://jsfiddle.net/g/YUza7/18/

anyway, you must use manual bootstrap with coffeescript on JsFiddle (the automatic was throwing the error because the coffeescript is not yet executed at that point)

EDIT: fixed the html: http://jsfiddle.net/g/YUza7/19/

OTHER TIPS

You can write:

TodoCtrl = ($scope) ->
    $scope.$watch 'one * two', (value) ->
        $scope.total = value

Unfortunately jsFiddle incorrect work with CoffeScript + AngularJS

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top