Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一长串控制器、服务、工厂、指令等文件,我不想在 HTML<script>的头部或正文中使用这个长长的列表。有没有办法把它们放在某个地方,让我的代码看起来更干净?
<script>
如果是内联脚本,请将所有代码放在外部 js 文件中并使用它。
如果你包含很多 js 文件(尽管这样做很好),如果你不想要太多的 js 文件,请使用像Grunt这样的构建工具来连接所有 js 文件。他们会将所有代码放在一个 js 文件中,您可以在最后包含该文件。