First Application in AngularJS:-
AngularJS applications are a combination or mix of HTML and JavaScript. The first thing you need is an HTML page.
Second, you need to include the AngularJS JavaScript file in the HTML page so we can use AngularJS:
Note:- You should always use the latest version of AngularJS, so it is not necessary to use the same version as the above example.
Steps to create AngularJS Application:-
Step 1 − Load framework Being a pure Being a pure JavaScript framework, It can be added using <Script> tag.
Step 2 − Define AngularJS Application using ng-app directive
Step 3 − Define a model name using ng-model directive
Step 4 − Bind the value of above model defined using ng-bind directive.
First Example of AngularJS:-
An AngularJS application consists of following three important parts −
How AngularJS integrates with HTML:-
. . . . . . . .
Second, you need to include the AngularJS JavaScript file in the HTML page so we can use AngularJS:
. . . .
Note:- You should always use the latest version of AngularJS, so it is not necessary to use the same version as the above example.
Steps to create AngularJS Application:-
Step 1 − Load framework Being a pure Being a pure JavaScript framework, It can be added using <Script> tag.
Step 2 − Define AngularJS Application using ng-app directive
...
Step 3 − Define a model name using ng-model directive
Enter your Name:
Step 4 − Bind the value of above model defined using ng-bind directive.
Hello !
First Example of AngularJS:-
AngularJS First Application Sample Application
Enter your Name:
Hello !
An AngularJS application consists of following three important parts −
- ng-app This directive defines and links an AngularJS application to HTML.
- ng-model This directive binds the values of AngularJS application data to HTML input controls.
- ng-bind This directive binds the AngularJS Application data to HTML tags.
How AngularJS integrates with HTML:-
- ng-app ng-app directive indicates the start of AngularJS application.
- ng-model ng-model directive then creates a model variable named "name" which can be used with the html page and within the div having ng-app directive.
- ng-bind ng-bind then uses the name model to be displayed in the html span tag whenever user input something in the text box.
- Closing Closing ' </div> tag indicates the end of AngularJS application.