Modern Web Development

Sign in to queue

Description

In this talk, Shawn will walk the attendees through the new way that web applications are being built today using the latest in client-side development the best practices of how to carry that out with ASP.NET MVC.

Day:

1

Level:

200

Embed

Download

Download this episode

The Discussion

  • User profile image
    Andrew Liang

    Thanks for the great video. Your clarity and elegance matches Scott Hanselman's. :)

    You have mapped your javascript initialization code to your view and controller. However, using this pattern, how would we implement views and javascipt code that are shared by two controllers? We would require two javascript files with virtually the same code. For example, if you have two controllers, Home and Account, and they both have an Index view that require the same javascript code, then two files need to be created that have the same code (ie: Home-Index.js and Account-Index.js) with the exception that they will be created with different object names.

    Most of the javascript code I have written/read, from my experience, are designed to work very closely with the view file and the model that's passed from the controller to the view. In my opinion, the javascript code shouldn't care what controller is used.

  • User profile image
    swildermuth

    Thanks Andrew. As far as the controller/view pattern I am using here. The goal of the home-index.js pattern is to quickly implement the initialization for a page. It is common for me to have the same underlying implementation called by both pages. So in your example, I'd simply put the code that two pages share in a JavaScript 'class' or 'module' and call from each initializer.

Add Your 2 Cents