AngularJS error: 'argument 'FirstCtrl' is not a function, got undefined'

前端 未结 16 1208
时光取名叫无心
时光取名叫无心 2020-12-01 05:55

I noticed the same question was asked a few times here, I tried so solve it but nothing helps.

I\'m following this tutorial with the egghead videos.

But whe

16条回答
  •  借酒劲吻你
    2020-12-01 06:36

    I just did this tutorial and followed @gion_13 answer. Still did not work. Solved it by making my ng-app name in the index identical to the one in my js file. Exactly identical, even the quotes. So:

    and the js:

     angular.module("myapp", [])
    .controller('FirstCtrl',function($scope) {
        $scope.data= {message:"hello"};
      });
    

    Weird how the ng-app has to be identical but the ng-controller doesn't.

提交回复
热议问题