Angular.js

Creating Simple APIs for your AngularJs App with .NET CORE Web API

Starting from the scratch So, we are starting with the empty Asp.net Core template. I’m using Visual studio 2015 and I’ve.NET Core RC2 SDK installed in my machine. Both of them are available for download in the following links, .NET Core SDK - https://www.microsoft.com/net/core Visual Studio 2015 - https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx Adding Dependencies We basically need two dependencies, one for serving static files (Microsoft.AspNetCore.StaticFiles) and another one for creating the APIs (Microsoft.AspNetCore.Mvc)…

Keep reading

Preventing XSRF in AngularJS Apps with ASP.NET CORE Anti-Forgery Middleware

What is Cross Site Request Forgery (XSRF/CSRF) Cross Site Request Forgery (XSRF/CSRF) is a type of a security breech where a hacker can trick the user into making unwanted requests to a web application where he/she is already authenticated. When a user is authenticated, his/her authentication cookie is stored in the browser’s storage. Since the cookie stays active unless the browser is closed and reopened, an authenticated user can be forced to make requests to the application from other unsafe applications too. For example, assume…

Keep reading

AngularJS and ASP.net Core 1.0 JumpStart (Part – III)

Creating the ASP.net Core 1.0 MVC project Okay, this part of the series will be pretty much big. So take time and read all the stuffs that I’ve done here. We will create a ASP.net Core 1.0 MVC project first. If you don’t have it installed already, please visit this link and follow the instructions to install it in your favorite operating system, https://docs.asp.net/en/latest/getting-started/index.html After installing, open up your Visual Studio 2015 and create a new…

Keep reading

AngularJS and ASP.net Core 1.0 JumpStart (Part – II)

Adding about and howto controllers Welcome to the part two of AngularJs and ASP.net Core 1.0 JumpStart! In part one we configured routing for our app and also attached views to those routes. We will implement the game logics in this post. To handle client side business logics, we will implement three angular controllers respective to the three views we have. Let’s implement the controllers for the howto and about views first since they are pretty much easier. In your app folder under js add two new…

Keep reading

AngularJS and ASP.net Core 1.0 JumpStart (Part – I)

Building the “Answer It!” app “Answer It!” is an app more like the famous TV show “Who wants to be a millionaire” but a bit different. Here a user will be presented with some predefined question sets. User will have to answer all the questions in limited amount of time and grab the glorious prize of “NOTHING”. I’ll build the app from scratch following some patterns and practices in both server and client side. In the end of this series you will have a good understanding on how to…

Keep reading

Make Your Coding Life Easy with Providers! (Angular.js Providers)

Introduction If you are running wild with Angular.js, then you may know that you can implement business logic in your controllers and use them in different parts of your application just by calling them. But as we all know, too much code in one place is never a good idea. And it is considered to be a good habit not to write a whole amount of business logic in a controller because you may have to use those same logic again in another controller. So doing the same thing…

Keep reading

Make Your Code Modular Buddy! (Angular.js Modules)

Unlike the Hello World Program, in real life an enterprise level application gets bigger and bigger day by day as the client's requirements flown in from here and there. Managing these kind of applications are easy when some heavyweight enterprise languages like C#, Java etc. are there for you. These heavyweight languages provides some features, where a client side language like JavaScript often lakes. Features like Class and Namespace are absent in JavaScript. But since every problem has a solution, with the help of JavaScript functions we can have both…

Keep reading

Control Your App’s Behavior (Angular.js Controllers)

In our previous Hello World example we simply defined a model [i.e. data.message] in our ng-model directive then we set some value on it and at the same time get the value from it. But how about we pass a predefined message to show at start up. Let me clarify what I'm saying. Let's modify our Hello World Program to look like this, <!DOCTYPE html> <html lang="en" ng-app> <head> <meta charset="UTF-8"> <title>Angular Controller</title&…

Keep reading

Hello from Angular (Angular.js Data Binding)

[If you are finding it difficult to grasp on what I wrote so far, don't worry! Stick with me. I will take baby steps to make you familiar with Angular.js and after seeing some simple examples, you will understand what I'm trying to achieve here with Angular.js] So let's see what we've got as our first example. If I’m right, when I said our first example. You are thinking like, "No!!! Not the hello world again!!!!" Actually you are right it's our very old friend Hello World…

Keep reading

What and Why’s of Angular.js

What is Angular.js Today I’m going to talk about a very popular client side web application framework called Angular.js. With the initial release in 2009 this super heroic JavaScript framework is still getting developed by the Google community and offering some mind-blowing features which developers wanted for so long. Built with only JavaScript this framework offers us to implement MV* (Model-View-Whatever) in our web application development to overcome development and testability overheads. Why Angular.js To take total advantage of a framework, first we must know why…

Keep reading