If at first you don't succeed, call it version 1.0

Contact Me

Sarvesh Kushwaha
Email : sarveshkushwaha@outlook.com

Total Pageviews

Powered by Blogger.

Google+ Followers

Friday, 13 November 2015

Angular.js for ASP.NET MVC Developers- Basics

Fiuuuuuuuu After a long time I am again thinking to write a series.This time most popular JS library i.e angular.js for asp.net MVC developers.
Being an ASP.NET developer, I didn't find many resources on the internet for angular.js with AS.NET MVC.In this First blog, I will Introduce the angular.js for ASP.NET MVC guys.

What is Angular.js?

AngularJS is a client-side MVW(W stands for whatever) or MV* framework written in JavaScript. It runs in a web browser and greatly helps us (developers) to write modern, single-page, AJAX-style
web applications.
We can angular.js is an opinionated framework or software which tells or suggest us how to solve a problem in an efficient manner.Although there can be many solutions to a problem but angular feature specifications tells to do them in an efficient manner.

 Why an ASP.NET MVC Developer should use it?

MVC developer has to write to much code on the client side as well.But why angular when we are already doing well with jQuery, knockout, kendoUi.
Following are the reasons why a developer should use Angular.js

  • Two-way data binding at client side (Knockout can be used, for jQuery we will have to write too much code in comparison to angular)

  • Declarative way to write code (knockout can be used as well) Fiddle
 <tr ng:repeat="item in invoice.items">
            <td><input type="text" ng:model="item.description"class="input-small"></td>           
            <td><input type="number" ng:model="item.qty" ng:required class="input-mini"></td>
            <td><input type="number" ng:model="item.cost" ng:required class="input-mini"></td>
            <td>{{item.qty * item.cost | currency}}</td>
                [<a href ng:click="removeItem($index)">X</a>]

  • The Well managed way to write the code at client side
  • Testing was the main concern for angular.js , We can do unit testing and end to end testing using  their KARMA tool which was specially designed for angular (known as testacular as well)
  •  HTML Templating
  • currency formatting
  • pluralization
  • reusable controls (By creating HTML Directives)
  • RESTful API handling
  • AJAX handling
  • modularization
  • dependency injection
                  Will elaborate each point in my coming blogs. :) :)