在下面的代码中,我创建了一个没有实例化的简单控制器。
var app = angular.module('newstalk',[]);
app.controller('articlectrl',[function(){
console.log("hi");
}]);
相应的HTML就是:
<html ng-app='newstalk'>
<!-- I have also included both angular js file and my js file in html-->
<body ng-controller='articlectrl'></body>
</html>
字符串hi未被记录。