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
高洛峰2017-05-15 16:52:40
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