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

前端 未结 16 1233
时光取名叫无心
时光取名叫无心 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条回答
  •  旧时难觅i
    2020-12-01 06:18

    I have faced this issue and it fixed with following way:

    1. first remove ng-app from:

      
      
    2. add name of ng-app to myApp:

    3. add this line of code before function:

      angular.module('myApp', []).controller('FirstCtrl',FirstCtrl);
      

    final look of script:

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

提交回复
热议问题