angular.js - When using angularjs, why is it reported that controller is not defined?
迷茫
迷茫 2017-05-15 16:50:40
0
2
641

I just started learning Angular, and when I tried to write a small demo, I got an error. . .

html:

js:

Error report:

------New error message= =#----

Rewritten according to @张博汉's method

Still getting the same error

Then I put ng-app="myApp"

Reported a new error T^T

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(2)
小葫芦

Cannot be used directlyfunction来定义controller

var myApp = angular.module('myApp',[]);

myApp.controller('GreetingController', ['$scope', function($scope) {
  $scope.greeting = 'Hola!';
}]);

Reference: https://docs.angularjs.org/guide/controller


Holdng-app改成ng-app="myApp"ah, dear

PHPzhong

How did the original poster solve the problem? Urgent, waiting online

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template