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

What is New in Angular 15? How to Upgrade to Angular 15?
9 May, 2023

Angular 15 Angular 15 is the latest version with numerous features and updates to improve the performance. It is important to know how to upgrade to Angular 15. The updates are made in the latest version to deliver a better …

A Guide to Angular 14 Features and New Updates
8 May, 2023

Introduction The Angular community released Angular 14 in 2022 with several improvements. Angular 14 has stand-alone components to reduce the need for Angular modules. It is the systematic pre-planned upgrade.Angular 14 is the most advanced,pre planned updates version to develop …

What is the latest technology of Angular?
3 May, 2023

Introduction To begin,Angular is one of the top front-end frameworks for web development. It is an open source, typescript based JavaScript framework to create dynamic, efficient web applications. Angular is worth learning with a lot of job opportunities. Typescript 4.7 …

Leave A Reply Cancel reply

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

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