The controller with the name 'mainController' is not registered

前端 未结 5 1237
死守一世寂寞
死守一世寂寞 2021-01-04 22:47

i have this code in my script.js file

var mainController = function($scope){
  $scope.message = \"Plunker\";
};

and this is my HTML

5条回答
  •  Happy的楠姐
    2021-01-04 23:32

    To paraphrase http://www.w3schools.com/angular/angular_modules.asp

     
    {{ firstName + " " + lastName }}

    The important line is

        app.controller("mainController", function($scope) 
    

    which injects your controller into your app

提交回复
热议问题