下面两种依赖注入写法等价:
【第一种】
app.controller('lrNListingController', function (Notifier, Private, timefilter, config) { // const Notifier = $injector.get('Notifier'); // const Private = $injector.get('Private'); // const timefilter = $injector.get('timefilter'); // const config = $injector.get('config'); //...other codes
【第二种】
app.controller('lrNListingController', function ($injector) { const Notifier = $injector.get('Notifier'); const Private = $injector.get('Private'); const timefilter = $injector.get('timefilter'); const config = $injector.get('config'); // ...other codes