下面两种依赖注入写法等价:
【第一种】
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
原文地址:https://www.cnblogs.com/lishidefengchen/p/8693038.html
时间: 2024-11-09 00:59:33