Showing posts with label AngularJs. Show all posts
Showing posts with label AngularJs. Show all posts

Wednesday, 13 April 2016

CSRF with Spring and AngularJS


csrf angularjs.jpg
In this blog, We will see how to configure CSRF protection and how to make AngularJS allowed to send information with a CSRF token to the server.

In AngularJS, $http service reads a token from a cookie which is named by default XSRF-TOKEN and sets it in HTTP header with name X-XSRF-TOKEN. Once it is configured, now spring running on server is supposed to insert token in cookie inside HTTP header. Now server can verify that the cookie matches X-XSRF-TOKEN HTTP header.
Let's see how it can be configured with Spring.

Step 1. Configure and enable CSRF.

Spring security comes with CSRF protection enabled. Please have a look of my previous blog.

Step 2. Configure Cookie in HTTP Header to enable CSRF for AngularJS

Here is the code below in your security configuration -
  1. http.csrf()
Read full Blog about CSRF with Spring and AngularJS at Findnerd.

Monday, 7 March 2016

What problems does AngularJS solves?


angularjs.jpg

AngularJS is a framework ( client-side ) for web applications that embeds HTML, CSS and Javascript. It basically focuses on:-
  1. Coding data access, Reading, form validations - are some functions in which many people are not good at while doing all these simultaneously. AngularJS provides separation between developer and designer. A developer can take HTML/CSS layout and a designer can refactor the layout without interfering into the code.
  2. Rendering views from data - Angular provides a brilliant feature of data binding. a. Injecting views, re-rendering when data changes. b.There are watchers, listeners to keep a look at the changes and informing about it after the code executes and manipulates (or updates) the model.
  3. Divided into fragments - Angular provides separation of concerns that accounts for enhanced testability. It is divided into pieces- controllers, services, views and models. It also provides a set of directives, filters, modules that helps in achieving the right balance of complexity.
  4. MVC architecture - Angular MVC structure provides a clean separation of layers. It separates the business logic from its presentation layer by dividing into three components.

Here is not the end...To read full article about What problems does AngularJS solves visit Findnerd.

Wednesday, 5 August 2015

Registering Service using value in angularJS

A service is created by a service factory and service factories are functions which are created by a service provider(constructor function).
When instantiating service provider, there must be a property named $get, which holds service factory logic.
The $provide provide helping method for registering services with the help of $injector.


When we talk about registering a service using value, here value is nothing more than a simple injectable value. The value can be a string, number, array, function, object. The difference between value and constant is, it can not be injected into configuration. It accepts two parameters, that are: name and value. Syntax is:


value(name, value);
For full Blog about Registering Service using value in angularJS visit FindNerd.
You can ask technology related questions at FindNerd Forum section. Mostly questions asked from the community Java, Androip, PHP and JavaScript forums.

Tuesday, 21 July 2015

AngularJS Controller

AngularJS applications are controlled by controllers. A controller is a JavaScript Object, which is created by a standard JavaScript object called constructor. In below example lastName and firstName are two properties of controller object demonstrated below.
To read this full blog on AngularJS Controller visit FindNerd.
You can read such more hot and trendy topics on AngularJS at our Javascript Development Blogs section.