Unit3 - Awp
Unit3 - Awp
1.ng-app directive
• ng-app directive defines the root element. It starts an AngularJS Application and
automatically initializes or bootstraps the application when web page containing AngularJS
Application is loaded
• Example:
2.ng-init directive:
• ng-init directive initializes an AngularJS Application data. It defines the initial values for
an AngularJS application.
• Example:
3.ng-model directive:
• The ng-bind directive tells AngularJS to replace the content of an HTML element with
the value of a given variable, or expression.
• If the value of the given variable, or expression, changes, the content of the specified
HTML element will be changed as well.
• Example:
2. Demonstrates the use of the following directives: i) ng-bind ii) ng-init iii) ng-model iv) ng-checked
• Example:
4.Demonstrate the two way data binding method with suitable example.
o Header and Footer: The header element specifies the header for the document or
section A footer typically contains the author of the document, copyright information,
links to terms of use, contact information, etc.
o Navigation Links: It is used for declaring a navigational section of the HTML
document. Websites typically have sections dedicated to navigational links that
enable the user to navigate the site.
o Article: This part specifies independent, self-contained content. It displays the
description part when the specific link is clicked.
• Example:
5.Explain controller in AngularJS with example.or Explain use of ng-controller directive in
context of Angular JS with suitable example.
Ans:
Controller in AngularJS:
• AngularJS controllers are used to control the flow of data of AngularJS applications. A
controller is defined using the ng-controller directive.
• Key Responsibilities of a Controller:
1. Handles user input and interaction.
2. Manages the application data.
3. Defines the behavior of the program.
4. Serves as an intermediary between the model and the view.
• Example:
•
9.Demonstrate the use of ng-route directive with suitable example.