0

I have a angular controller I have

@MyAngular = ($scope) -> 
    $scope.my = [...]
@MyAngular.$inject = ["$scope"]

I get this message error : Argument 'MyAngular' is not a function, got undefined. In my view, I have %div{"ng-controller" => "MyAngular"}

I found some SO posts and but nothing did the trick

6
  • what is this syntax %div{"ng-controller" => "MyAngular"}?
    – zs2020
    Commented Aug 18, 2013 at 18:02
  • @sza it is haml syntax, but this is not the problem ;)
    – epsilones
    Commented Aug 18, 2013 at 18:04
  • AngularJS is javascript. It has nothing to do with rails. Can you just use <div ng-controller="MyAngular">
    – zs2020
    Commented Aug 18, 2013 at 18:05
  • @sza %div{"ng-controller" => "MyAngular"} in an html.haml file is the exact equivalent of <div ng-controller="MyAngular"> !
    – epsilones
    Commented Aug 18, 2013 at 18:08
  • Ok. I am curious you are using too many frameworks for just simple javascript and html...haml, coffeescript... just for the sake of using that?
    – zs2020
    Commented Aug 18, 2013 at 18:10

1 Answer 1

0

Ok I got i, I put in a more cleaner way

app = angular.module "MyApp", []
app.controller 'MyAngular', ['$scope', ($scope) ->
  $scope.my = [...]
]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.