我有以下脚本:
/// <reference path="updateAjax.ts" />
/// <reference path="updateSetUp.ts" />
/// <reference path="../../Shared/typescript/reference.ts" />
module Admin.Grid {
export function updateField(entity: string, $link: JQuery) {
var link = new Link($link),
idArr = $link.attr("id"),
idTmp = idArr.split("_");
link.AdminParams = Admin.Shared.getAdminParams(entity),
link.Entity = entity;
link.InputFieldType = $link.attr('id').split('_')[1];
link.Row = idTmp[2],
link.PartitionKey = $("tr[id='row_" + link.Row + "']").attr('data-pk'),
link.RowKey = $("tr[id='row_" + link.Row + "']").attr('data-rk');
link.InputFieldValue = $link.is(":checkbox") ? $link.is(":checked") : $link.val(),
updateSetUp(link);
updateAjax(link);
}
}
在另一个档案中:
/// <reference path="../../Shared/typescript/reference.ts" />
module Admin.Grid {
export function updateSetUp(link: Link) {
$("#modified_" + link.Row).html('Updating');
$("#modifiedBy_" + link.Row).html('Updating');
$("#input_" + link.InputFieldType + "_" + link.Row)
.next('span').remove().end()
.after('<span class="check-waiting"></span>');
}
}
当第一个脚本编译为javascript 时,我看不到对updateSetup(链接)或updateAjax(链接)的任何调用
我在VS2012中使用网络必需品工作。我没有收到错误消息或红色下划线。据我所知,我的所有链接都是正确的。删除文件并重新创建没有任何区别。
以下是生成的javascript:
var Admin;
(function (Admin) {
(function (Grid) {
function updateField(entity, $link) {
var link = new Link($link);
var idArr = $link.attr("id");
var idTmp = idArr.split("_");
link.AdminParams = Admin.Shared.getAdminParams(entity) , link.Entity = entity;
link.InputFieldType = $link.attr('id').split('_')[1];
link.Row = idTmp[2] , link.PartitionKey = $("tr[id='row_" + link.Row + "']").attr('data-pk') , link.RowKey = $("tr[id='row_" + link.Row + "']").attr('data-rk');
link.InputFieldValue = $link.is(":checkbox") ? $link.is(":checked") : $link.val() , Grid.updateSetUp(link);
Grid.updateAjax(link);
}
Grid.updateField = updateField;
})(Admin.Grid || (Admin.Grid = {}));
var Grid = Admin.Grid;
})(Admin || (Admin = {}));
答案 0 :(得分:2)
调用的确存在已编译的代码中。请注意,自由使用逗号而不是分号会产生很长的行:
link.AdminParams = Admin.Shared.getAdminParams(entity) , link.Entity = entity;
link.InputFieldType = $link.attr('id').split('_')[1];
link.Row = idTmp[2] , link.PartitionKey = $("tr[id='row_" + link.Row + "']").attr('data-pk') , link.RowKey = $("tr[id='row_" + link.Row + "']").attr('data-rk');
link.InputFieldValue = $link.is(":checkbox") ? $link.is(":checked") : $link.val() , Grid.updateSetUp(link);
Grid.updateAjax(link); //<<<here and ... ^here^