How to use AngularJS in ASP.NET MVC and Entity Framework

This post is taken from Dhananjay Kumar.

In short, this post will touch upon:

  • adding an AngularJS library in ASP.NET MVC;
  • reference of AngularJS, bundling and minification;
  • fetching data using the Entity Framework database;
  • returning JSON data from an ASP.NET controller;
  • consuming JSON data in an AngularJS service;
  • using AngularJS service in AngularJS controller to pass data to the view; and
  • rendering data on an AngularJS View

Continue reading

Advertisements

MVC app vs. Single Page App

We build a single page app instead of a standard MVC app to avoid re-rendering pages and performance issues. Also SPAs can provide a rich, desktop-like environment.  But what to choose ..?

SPA needs heavy jQuery Ajax to build frontend and mixed frontend tools like Angular JS, duplicate js models, Knockout JS to do the binding and etc… SPA looks pretty, fancy and responsive. but, it’s hard to unit test since its complicated and mixed technologies all over the place. I would suggest to use Regular MVC structure while build medium to large app, utilize area to grouping the feature of your app. you can implement good security measurement, apply strong validations to your app. your app will close to HTML easy for maintenance, light jQuery that enhances the UI is already good when you want to focus on the functions and features instead of fancy UI. Continue reading

AngularJS & Kendo UI using Angular Kendo with ASP.NET MVC 5, Web API & OData

A nice post on AngularJS and ASP.NET MVC

Long Le's Blog

Update: 5/1/2014 – Customer View & customerController.js has been updated to toggle styles by manipulating the DOM through the ViewModel with ng-show to adhere and stay consistent with AngularJS best practices.

Update: 5/14/2014 – Added section “Animating our View Swapping”, to elaborate on adding animation to the “ng-view” swapping process.

Source code: http://goo.gl/6Z9jop
Live demo: http://longle.azurewebsites.net

With AngularJS and ASP.NET MVC, we now have an MVC pattern and architecture for both on the client and server. What do we do and/or how do we approach this? Well one can argue we don’t use any of the MVC architecture on the server and build out a full-fledged AngularJS front-end application and only use make async calls to Web API for all things that absolutely need to be on the server e.g. CRUD, workflows, business logic, etc.

Now, there’s absolutely nothing wrong with this approach, and for the most part a lot…

View original post 1,530 more words

How to Learn AngularJS

AngularJS is a javascript library that provides tools for writing rich browser applications. 

The basics of Angular can be broken down into 5 major components:

  • Directives
  • Controllers
  • Scopes
  • Services
  • Dependency Injection

It’s important to note that in the Angular, we’re not looking up elements by a selector and then directly manipulating the HTML. Instead, we’re declaring where the variables should be attached and then Angular takes care of the plumbing for us.

The angular way of developing applications dictates that we take care of the data and angular will take care of the DOM manipulation.