demo.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>AngularJS</title>
<script src="angular.min.js"></script> <!-- 引入AngularJS框架 -->
</head>
<body ng-app="App">
<script>
var App = angular.module('App',[]);
// '$scope'表示依赖的模块,function表示依赖注入(行内式注入)
App.controller("DemoController",['$scope','$http',function($scope,$http) { //function中的形参可以改(顺序要对应)
}]);
// 推断式注入(function中的形参命名要根据内置模块来命名) (不建议使用,因为压缩时变量名会变短)
App.controller("DemoController",function($scope,$http) {
});
</script>
</body>
</html>