JavaScript for C# Developers

Instructor Dan Wahlin

Is JavaScript worth taking the time to learn if I’m a server-side .NET developer? How much of C# carries over to JavaScript? In this video, Dan Wahlin answers these questions and more while also discussing similarities between the languages, key differences, and the future of JavaScript (ES6). If you’ve been wanting to push more of your application’s functionality to the client by using JavaScript then this video will provide solid look at how you can get started.

Show Transcript
Want more free webinars? Sign-up for our mailing list!
Dan Wahlin

Dan Wahlin is the founder of Wahlin Consulting which specializes in Web technologies such as JavaScript, AngularJS, HTML5, Node.js, C#, ASP.NET MVC, Web API and SharePoint. He speaks at conferences and user groups around the world and has written several books on Web technologies. He has also published several courses covering a range of technologies including the new AngularJS JumpStart course. Dan blogs at weblogs.asp.net/dwahlin, runs the Web Weekly newsletter (a great way to stay up on the latest technologies), and writes columns for various technical magazines.

Comments:

See what people are saying...

  1. Interface Technical Training

    —–Here are the chat questions that occurred during the live webinar.—–
    Dan Wahlin : Thanks for coming everyone!
    Mikeb : Thanks for this webinar Dan! …a future vid on Angular/WebApi authentication would be great! (eg JWT tokens?)
    Bohra : If we use control like telerik grid/jqgrid…how do we do bi directional data binding?
    Jason W : Does the customer manager sample show authentication and authorization?
    Serg[Russia] : btw CodeSchool has a great BASE FREE course for the AngularJS
    vmlf : What test framework/CI do you recommend for Web API?
    Michael : @Dan What’s your opinion on the factory returning the promise “unwrapped” already so the controller doesn’t need to know it’s getting an HTTP promise?
    Dan Wahlin : atishay: Hard to answer with a chat, but in a nuts a promise is like an “I owe U” that the consumer can wire to a success/fail function whereas a callback function has to be ped in as a parameter and then gets invoked once the async result returns.
    atishay : @dan whats the difference between a promise and a call back?
    vmlf : watch out: the success/error are specific to $http, they are not in $q promises
    Dan Wahlin : Serg: Yep – that part could definitely be better.
    Serg[Russia] : @Dan, but model has typed properties. But unfortunately JS doesn’t have types and I see strings everywhere during debugging
    Dan Wahlin : Daniele: Definitely check out my buddy John Papa’s style guide up on Github: https://github.com/johnpapa/angularjs-styleguide
    Dan Wahlin : Serg: Yep – typically have to go with “Any” in that scenario with TS – when it’s random data types.
    Serg[Russia] : agree with BP. We used mixes from the SideWaffle and JohnPapa recomendations
    Dan Wahlin : Schwarty: Hey man! Yep – you guys have a great example for using TypeScript with Angular. I think you made a great decision given the future of ES6. Hope all is well your way!
    BP : SideWaffle has some good templates to get you started.
    Serg[Russia] : @Dan, yep Dan. But sometimes Angular doesn’t know about types. For example when $stateParams reads data form the query URI. They all are strings
    guest_402 : @Dan I would also be very interested to see examples of apps using TypeScript and Angular, if you know of any?
    Daniele : @Dan Do you have some best-practices to follow for implementing Controllers, Directive and Services / Factory in Typescript?
    Schwarty : I agree about TypeScript @Dan 🙂
    Dan Wahlin : AngularNewBi: I have quite a bit of Angular code up on http://github.com/danwahlin but don’t have anything with TypeScript right now that’s specific to Angular. We’ve done quite a bit of work with a few companies using TS with Angular though.
    Dan Wahlin : Serg: TypeScript is super cool in my opinion and can be used with Angular. It’s like using ES6 today + adding type support (number, boolean, etc.).
    AngularNewBi : @Dan: Thanks alot Dan
    Dan Wahlin : https://docs.angularjs.org/api/ng/service/$http#get
    Dan Wahlin : AngularNewBi: Oops – hit enter too soon. Here’s the link:
    Serg[Russia] : @Dan, thanx! That’s what I do now. But for example 2xx httpcodes has no bodies. I send the message and see nothing on the client
    Dan Wahlin : AngularNewBi: It’ll re-issue the request but you can control the caching as well. Some details above the get() function in the docs:
    AngularNewBi : @Dan: Do you have any open source code where Angular app is built using TypeScript other than the TodoMVC app available on the internet?
    Dan Wahlin : Sergey: You can return a custom HTTP exception object in that case if you need to be more specific. The Http response can return a custom message, code, etc. The short-cut methods I show here are nice but won’t work for every situation.
    Serg[Russia] : what profit of the TS? We use it but it seems that we get nothing except headacke
    guest_402 : @AngularNewBi. May I ask why the preference?
    AngularNewBi : @guest_402: I prefer native JS rather than TypeScript.
    Serg[Russia] : we use the TS
    guest_402 : Do you prefer to write your Angular apps using native JS or do you use TypeScript?
    AngularNewBi : @Dan: When we use $http.get, does angular cache the response and returns that by default when we make the same call again to same URL?
    Dan Wahlin : atishay: Services and factories both act as singletons in Angular and can do the same things. I prefer a factory because you control the actual object that’s returned, but services work just as well.
    Sergey[Russi : @Dan, IHttpActionResult is a great option as the result type. But return NotFound() doesn’t allow to return the message from the server (like no persons with this name or with this birthdate). What the solution if I need to return some additional info except an empty arraynullor httpresult?
    atishay : do a service have all the functionality of a factory?
    Bohra : There are lots of articles about doing authentication and authorization using oAuth/Azure etc…but is it possible to do single sign on with windows authentication using angular. i.e if my app is running on a desktop inside the network I don’t need to login to the SPA?
    DTeel : In the service, would access like dataService.getCustomers?
    Dan Wahlin : guest_402: Yep – know of several large scale apps in the wild from some huge companies. Can’t say the names unfortunately but you likely use their products.
    Victor : @Dan what is your opinion on using OdataController instead of normal APIController?
    Dan Wahlin : guest_5825: Injection is pretty subjective. You can do it using the [‘…’] syntax, $inject, or even automate it. Really comes down to personal preference. I generally prefer $inject in “real” apps. Some of my buddies like to automate it.
    guest_402 : @Dan. Have you created any large scale business applications using Angular and Web API? Or do you know of any ‘in the wild’?
    guest_5825 : @Dan Should we inject dependency like as shown or use $inject.
    Jeremy @ MN : Dan – I just purchased your AngularJS Udemy course. Is this material (AngularJS + Web API) covered in that course? Also, I saw that someone else already asked this, but I didn’t see the answer – is this source code somewhere?
    Dan Wahlin : Pete: $http is a lower-level version of $resource. Using $resource is great when your RESTful service is setup nicely since it saves some code. I generally use $http but it really just depends on what you want to do.
    guest_5825 : @Travis Knockout is just DataBinding, Angular is full-fledged framework including routing, data management. Can’t compare Knockout with Angular, though you can compare Angular with Durandal
    Dan Wahlin : Travis L: Angular is a framework that has many features including data binding. Knockout would be a library that focuses solely on data binding. Angular also adds a lot of additional functionality that can be used to build SPAs.
    pete : Curious: is $http better to use than $resource?
    Travis L. : How does AngularJS compare to knockout? Does one have advantages over the other?
    Mikeb : Yes, a future vid on using BreezeJS as the “glue” would be awesome!
    Dan Wahlin : Someone asked me about Breeze. The focus of this webinar is on native Angular features and Web API so I won’t be covering Breeze. Definitely a cool client-side library though – maybe in another Webinar. 🙂
    Sergey : Daniele, I’m with you! I have the same questions. Except we already have implementation for 3 and use the 2
    Daniele : I have three question for Dan Wahlin: 1) Can you explain the difference from Services , Factory and Providers especially about instance life-cycle! (are all “kind of” Singletons?) 2) what do you think about using Typescript with Angular? 3) And do you have some best-practices to follow for implementing Controllers, Directive and Services / Factory in TS?
    Rasmus : No to IE 8
    La Crosse : Daniel: General AngularJS Question – We need to support IE8, should we use AngularJS?
    guest_2735 : Dan please don’t forget breezejs..

Share your thoughts...

Please fill out the comment form below to post a reply.

Upcoming Courses
Dan Wahlin Teaches

ANGL4 - ANGL4: Angular 4 and TypeScript Single Page Application (SPA) Development

CS215 - CS215: C# Programming with Visual Studio

CS314 - CS314: Advanced C# Programming with Visual Studio

ANGL4 - ANGL4: Angular 4 and TypeScript Single Page Application (SPA) Development

CS410 - CS410: C# Design and Application Patterns

CS215 - CS215: C# Programming with Visual Studio

ANGL4 - ANGL4: Angular 4 and TypeScript Single Page Application (SPA) Development

ANGL4 - ANGL4: Angular 4 and TypeScript Single Page Application (SPA) Development

CS215 - CS215: C# Programming with Visual Studio