简体   繁体   中英

MVC: Get jQuery Intellisense in T4 Templates

Is there any way to get jQuery Support / Intellisense in T4-Templates? In normal js-Files ,

I can write

/// <reference path="/Scripts/jQuery/jquery-1.6.2-vsdoc.js" />

But how to do it in T4-Templates ?

EDIT

The reason why we want to do so: because we seperated our JavaScript in external js-Files. Doing so means that it is no longer possible to use c#-Code in our JavaScript to avoid magic strings. For example:

Instead of writing:

$j.ajax({
        url: '/Home/Edit'
        type: 'POST',
        dataType: 'html'
        data: {},
        error: function() {
            DisplayMessage("Error while generating filter dialog");
        }
});

we write:

$j.ajax({
        url: '<#= ControllerViewNameProvider.FilterSettings.ControllerName #>/<#= ControllerViewNameProvider.FilterSettings.Actions.GetFilterDialog #>'
        type: '<#= EnvironmentStringProvider.HttpMethodPOST #>',
        dataType: '<#= EnvironmentStringProvider.DataTypeHTML #>'
        data: {},
        error: function() {
            DisplayMessage("<#= MessageStringProvider.ErrorMessages.GenerateFilterDialogFailed #>");
        }
});

Short: Unfortunately not

There's no way (at least not that I'm aware of) of getting javascript intellisense into T4. It would have to be provided by means of an addon just like it is for c# code.

But there's a different question that bothers me: What has jQuery code to do in a T4 template in the first place ? It's a design time template anyway and not runtime.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM