Call Us Now!
Velachery: +91 9884412301 | OMR: +91 9600112302
info@credosystemz.com
AngularJS Training in ChennaiAngularJS Training in Chennai
  • Home
  • Course Content
  • Realtime Projects
  • Interview Q&A
  • Contact Us
  • Home
  • Course Content
  • Realtime Projects
  • Interview Q&A
  • Contact Us

Blog

  • Home
  • Blog
  • Top 10 Directives in AngularJS

Top 10 Directives in AngularJS

  • Posted by admin
  • Categories Blog
  • Date March 20, 2019
  • Comments 0 comment

Directives are the normal HTML Syntax. AngularJS allows you to extend existing HTML syntax with new attributes called as Directives. AngularJS comes with set of inbuilt Directives and all the Directives has individual behaviors.

All the Directives are starts with the prefix of “ng-”. Also AngularJS allows the developer to create custom Directives with custom behaviors.

To Know More about all the Directives and other Topics, Please Visit AngularJS Complete Topics.

Here are the list of Top 10 Directives in AngularJS,

  1. ng-app
  2. ng-model
  3. ng-bind
  4. ng-click
  5. ng-controller
  6. ng-hide / ng-show
  7. ng-if
  8. ng-include
  9. ng-repeat
  10. ng-submit

1.ng-app:

This directive is used for auto bootstrap an AngularJS Application. It’s also called as root element of an AngularJS. This directive almost placed on <html> or <body>. Without this directive we can’t implement AngularJS in our application.

We can use only one ng-app directive per HTML Document. If you use multiple ng-app directives, the 1st one will be auto bootstrap the application. You can pass application name as a parameter of ng-app .

Syntax:

ng-app=”myApp” .

 

2.ng-model:

ng-model Directive is used for Bind AngularJS application data into Input elements like text, password, select, check box, radio, etc.,

Syntax:

<element ng-model=”name”></element>

Here the elements are All types of Input elements.

 

3.ng-bind:

This directive used for bind angularjs application data into the views. We can bind the application data through a variable and whenever the variable value gets change, automatically the view update the value and vice versa.

Syntax:

ng-bind as a Attribute

<element ng-bind=”expression”></element>

ng-bind as a Class

<element class=”ng-bind: expression”></element>

Bind the values by using an expression

{{expression}}

 

4.ng-click:

ng-click directive just like a onClick event. ng-click allows you to call a angularjs function when an element clicked. We can use onClick and ng-click together in a same element. 1st onClick will trigger after that ng-click event trigger.

Syntax:

<element ng-click=”functionName”></element>

 

5.ng-controller:

ng-controller directive is used for controller angularjs Application data. Also it allows you to attach your application controller to the view. The controller scopes are based on the element scopes. This ng-controller directive allows nested that we can use a controller within a controller.

Syntax:

<element ng-controller=”expression”></element>

 

6.ng-hide / ng-show :

ng-hide / ng-show directives are used to show are hide the views (HTML Template) based on the Boolean values. Every ng-hide, ng-show has a expression which having Boolean values.

Syntax:

<element ng-hide=”expression”></element>

If the above expression is true then the element will be hide and if it’s false the element will be show.

<element ng-show=”expression”></element>

If the above expression is true then the element will be show and if it’s false the element will be hide.

 

7.ng-if:

This directive works like ng-hide but the different is ng-hide just hide the element based on the truthy value and ng-if remove the element based on the truthy value. If the ng-if expression value is false means it will remove from the document and when the value gets true it will again attach the element into the document.

Syntax:

<element ng-if=”expression”></element>

 

8.ng-include:

ng-directive is used for include external html file into the application. The including html file should be child node of the specified element.

ng-include directive have a expression and the expression have the value of external file name.

Syntax:

ng-include as an element

<ng-include src=”filename”></ng-include>

ng-include as an attribute

<element ng-include=”filename” ></element>

 

9.ng-repeat:

ng-repeat directive repeat the specific html element until the number of times of an array elements. It clones the html elements at every iteration.

The collection should be an array or object.

Syntax:

<element ng-repeat=”variableName in Array/Object Name”></element>

 

10.ng-submit:

ng-submit directive like onSubmit event. It will trigger the function while your form submit. This directive attached on form and it will work only when the form doesn’t contain action.

  • Share:
admin

Previous post

Types of Filters in AngularJS
March 20, 2019

Next post

5 Main pillars of AngularJS
March 20, 2019

You may also like

AngularJS Introduction
20 March, 2019

Here is the Introduction of the Powerful and Super heroic Framework – AngularJS. You can find the following details here. Introduction of Angularjs. Why AngularJS ? Features of AngularJS. Reason to Learn AngularJS. Disadvantages of AngularJS. To know about the …

5 Main pillars of AngularJS
20 March, 2019

Here is the 5 Main pillars of AngulaJS. These are very important components to develop a powerful and Rich web applications in AngularJS. Lets Take a glance about the 5 Pillars of AngularJS. Directives Controllers Scopes Services Dependency Injection Please …

Types of Filters in AngularJS
20 March, 2019

AngularJS provides you list of amazing inbuilt filters.  You don’t need to write any additional methods to get use of these filters features. Just add the filter in your expression and Enjoy the Benefits. To know more about All other …

Leave A Reply Cancel reply

Your email address will not be published. Required fields are marked *

Customer reviews across the Internet

CREDO SYSTEMZ5 Star Rating: Recommended - Best IT Training in Chennai
5 out of 5 based on 16224 reviews

Sulekha        5 Star Rating: Recommended - Best IT Training in Chennai

Yet5               5 Star Rating: Recommended - Best IT Training in Chennai

Facebook      5 Star Rating: Recommended - Best IT Training in Chennai

Google+        5 Star Rating: Recommended - Best IT Training in Chennai

Justdial         5 Star Rating: Recommended - Best IT Training in Chennai

Thinkvidya   5 Star Rating: Recommended - Best IT Training in Chennai

CREDO SYSTEMZ – VELACHERY

New # 30, Old # 16A, Third Main Road,
Rajalakshmi Nagar, Velachery,
(Opp. to Murugan Kalyana Mandapam),
Chennai - 600 042.
Mobile: +91 9884412301
Email: info@credosystemz.com
Web: www.credosystemz.com

CREDO SYSTEMZ – OMR

Plot No.8, Vinayaga Avenue,
Rajiv Gandhi Salai, (OMR),
Okkiampettai,
Landmark - Okkiyampet Bus Stop,
Next to Buhari Hotel,
Chennai – 600 097.
Mobile: +91 9600112302

TRENDING COURSES

  • Python Training in Chennai
  • Data Science Training in Chennai
  • AWS Training in Chennai
  • Big Data Hadoop Training in Chennai
  • Machine Learning Training in Chennai
  • Angular Training in Chennai
  • Mean Stack Training in Chennai
  • RPA Training in Chennai
  • DevOps Training in Chennai
  • R Programming Training in Chennai
  • Microsoft Azure Training

Copyright 2022 Angularjstraininginchennai.in | All Rights Reserved