只是学习依赖注入,我想我已经开始理解它了.
如果我走在正确的轨道上,请告诉我......
例如:这两个是等价的吗?
/* injection method */
function <controller_name>($scope) {}
<controller_name>.$inject = ['$scope'];
/* other method */
var app = angular.module('myApp');
app.controller(<controller_name>, function($scope) {});
Run Code Online (Sandbox Code Playgroud)