How to Configure T4JS

All configuration for T4JS exists in the T4JS.tt.settings.t4 file

JavaScriptNamespace

Change this value to a namespace appropriate for your application.  This namespace becomes the prefix for all the endpoints that will be generated.  If you're unfamiliar with the concept of namespaces in JavaSciprt, try searching for "global abatement in javascript."

Let's change the namespace to "my.site"

Now, let's assume you have a Home controller with an Index method. 

You'll be able to access the URL and associated details in JavaScript like so:

var url = my.site.endpoints.home.index.build();

This assigns the url variable the value "/home/index"


JavaScriptEndpointObject

This value is the name of top level object in your namespace which holds all of the URL endpoint object structures.  If you prefer an object name other than "endpoints," you can modify it to suit your needs.

Let's change the object name to "siteUrls"

Now, given the same example above, you would access the URL like so:

var url = my.site.siteUrls.home.index.build();

This assigns the url variable the value  "/home/index"


RoutePrefix

This value is prepended to all generated URL paths.  If you are running in a virtual directory or doing custom routing, you'll add your prefix here.  Also, you may prefer to omit the leading slash and simply use relative paths. 

Let's change the path to "/internal/"

Now the url variable above is assigned the value "/internal/home/index"

 

AttributeNamespace

This setting specifies the C# namespace for the AjaxEndpoint attribute

 

AreasFolder

This is the folder in the project containing the Area

 

ControllersFolder

This is the folder in the project that contains the Controllers.

Last edited Apr 22, 2011 at 10:36 PM by tylerbrinks, version 5

Comments

No comments yet.