简体   繁体   中英

No intellisense in javascript (*.js) file when using T4MvcJs

I have started using T4MvcJs in my project recently. The problem I am facing is that, I am unable to use Intellisense feature in my javascript file ( .js) when using T4MvcJs (generated strongly-typed) URLs, and I have to type precisely all strongly typed URLs without intellisense. Note that, javascript ( .js) file is separately maintained from its razor view file (*.cshtml). This is making the usage of T4MvcJs very difficult.

Please guide, whether intellisense feature is available in T4MvcJs or not? If availble, kindly guide how to enable/use it?

For example: The url in my javascript file w/o using T4MvcJs is declared as

var _url = "/Home/Index"

Kindly guide, how can I write the above url using T4MvcJs in my javascript (*.js) file. Also explain, how to achieve it using intellisense.

Application Plateform: C# + MVC4 , VS 2013

If you have a script folder in your application put the jQuery file in that folder and create another script in that folder name it _references.js

in the references.js add this code

/// <reference path="The name of jQuery file you want to reference if its in the same folder" />

if you cannot keep the jQuery file in your folder then give the appropriate path of the jQuery file that is located and the intellisense of the jQuery file will be available to you.

This works for me whenever I add a new nugget package I add the reference path in the references jscript file give it a try and let us know

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