更新时间:2023-11-22 19:33:34
不幸的是,似乎没有完美的解决方案,但我现在是这样解决的:
Unfortunately there does not seem to be a perfect solution but this is how I solved it for now:
文件控制器/MainController.ts":
File 'Controllers/MainController.ts':
class MainController {
...
}
export = MainController;
文件'Controllers/SecondController.ts':
File 'Controllers/SecondController.ts':
class SecondController {
...
}
export = SecondController;
文件控制器/命名空间.ts":
File 'Controllers/Namespace.ts':
import MainController = require('./MainController');
import SecondController = require('./SecondController');
export = { MainController, SecondController }
文件App.ts"(使用命名空间")
File 'App.ts' (where the 'namespace' is used)
import Controllers = require('Controllers/Namespace');
angular.module('app', [])
.controller('MainController', Controllers.MainController)
.controller('SecondController', Controllers.SecondController)
这为您提供了很好的智能感知,隐藏了 400 条导入语句,并使实际使用命名空间的代码非常干净......
This gives you nice intellisense, hides the 400 import statements away and keeps the code where the namespace is actually used pretty clean...