Javascript 在Html页面中处理大量外部JS文件有什么好方法吗?
考虑下面的问题Javascript 在Html页面中处理大量外部JS文件有什么好方法吗?,javascript,Javascript,考虑下面的问题 <html ng-app="crudModule"> @{ ViewBag.Title = "Index"; } <body ng-controller="crudController"> <table id="tblContainer" border="1"> <thead> <tr> <th>EmpName</
<html ng-app="crudModule">
@{
ViewBag.Title = "Index";
}
<body ng-controller="crudController">
<table id="tblContainer" border="1">
<thead>
<tr>
<th>EmpName</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="emp in Employees" my-employee="emp"></tr>
</tbody>
</table>
<script type="text/ng-template" id="Employee.html">
<tr>
<td> <span>{{_employee.EmployeeId}}</span></td>
</tr>
</script>
</body>
</html>
<script src="~/Scripts/angular.js"></script>
<script src="~/Scripts/angular-route.js"></script>
<script src="~/Scripts/MyScripts/Module.js"></script>
<script src="~/Scripts/MyScripts/Service.js"></script>
<script src="~/Scripts/MyScripts/Controller.js"></script>
<script src="~/Scripts/MyScripts/Builder.js"></script>
<script src="~/Scripts/MyScripts/Utility.js"></script>
@{
ViewBag.Title=“Index”;
}
EmpName
{{{u employee.EmployeeId}
同一页面中有许多外部javascript文件
有没有什么好方法可以让页面只包含一个JS文件,而其他JS文件则位于该JS文件内,或者其他任何方式?这是asp.net/mvc使用脚本绑定。看
谢谢您可以使用这样的服务。首先你需要安装
节点
,然后安装grunt
,但这样做的好处是巨大的。请查看requirejs@-我从未使用过它,但它听起来像是你在寻找的。注意,如果不是示例中的MVC代码,我不会建议这样做。当您使用MVC时,利用它的框架并没有什么错。