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

Что можно фотографировать в повседневной урбанистической жизни
9 November, 2026

Что можно фотографировать в повседневной урбанистической жизни Городская пространство дарит изобилие оптических перспектив для фотографа, способного видеть окружающие детали. Архитектурные структуры, дворовые эпизоды, игра света на стенах и повседневные 7к казино эпизоды бытия горожан порождают многообразный основу для съёмки. Фотография …

Casino on-line entry overseas: currencies, languages and local limitations
6 November, 2026

Casino on-line entry overseas: currencies, languages and local limitations Online wagering platforms run across multiple regions, yet availability requirements change substantially dependent on player position. Providers must adhere with local regulations, which generates a complicated framework of availability. Geographic restrictions …

Casino on-line guide for modern players
6 November, 2026

Casino on-line guide for modern players Digital gambling platforms offer entertainment for players worldwide. Modern operators provide thousands of games, secure payments, and promotional campaigns. Understanding platform functions helps players select Codice bonus Big Casino a suitable operator. This guide …

Leave A Reply Cancel reply

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

non gamstop casinos

non gamstop casinos

casinos not on gamstop

casinos not on gamstop

casinos not on gamstop

casinos not on gamstop

non gamstop casino

non gamstop casinos

non gamstop casinos uk

best non gamstop casinos

Copyright 2022 Angularjstraininginchennai.in | All Rights Reserved