This is my first blog.I am just explaining the basics of AngularJS and Sample application in an interesting way so that anyone can create an Angular application. Let’s see how we can create :)
Angular.js is a MV* (Model – View – Whatever) JavaScript framework which is maintained by Google which excels in the creation of single-page-applications or even for adding some “magic” to our classic web applications.
Let's get started :) -
Why Angular?
If you are using JavaScript to create a Dynamic Website, Angular is a good choice.
It's a client-side JavaScript framework for adding to HTML.
1) Angular Helps you organize your JavaScript.
2) Angular helps create responsive (as in fast) websites
3) Angular plays well with JQuery
4) Angular is easy to test.
Traditional Server Side Response-Request:-
AngularJS response-request:-
In this Blog we will learn about basic and sample application:-
1) Directives
2) Module
4) Expression
3) Controller
Directives:-
A directive is a marker on a HTML tag that tells Angular to run on reference some JavaScript code.
Before we proceed, download the below libraries which we are going to use:-
AngularJS: - http://angularjs.org/
We'll need angular.min.js
Twitter Bootstrap: - http://getbootstrap.com/
We'll need bootstrap.min.cs
Getting Started:-
Just create an empty web application.
Add two folders: - scripts and stylesheet.
Inside script folder copy angular.min.js and and inside styleshhet bootstrap.min.css.
Then add app.js new JavaScript file in scripts folder and index.htm to create our first AngularJS application.
2) Modules:-
What's a module in AngularJS? Here it is:-
Where we write piece of our Angular application.
Make our code more maintainable, testable and readable.
Where we define dependencies for our app.
Creating our first module inside app.js.
Including our module in index.html:-
3) Expressions:-
What's is expression?
Expression allow you to insert dynamic values into your HTML.
4) Controllers:-
What's a controller in AngularJS?
Controller is where we define our app's basic behavior by defining function and values.
Referencing controller in index.html in
Below is the code snippet to create your first application.
So here how we can create a simple AngularJS application.
So in this blog we learned basic of AngularJS Directives, Module, Expression and Controller and kick started.
In my coming blogs we'll deep dive into AngularJS and learn more.