AngularJS Directives

                                             

                                              AngularJS Directives

AngularJS allows you to extend the HTML attributes with the new directives. AngularJShas built-in policy structure that offers functionality for applications.AngularJS It is also possible to allow you to set your own directives.AngularJS allows you to extend HTML with new attributes called directives.
AngularJS has incorporated in the set of directives that offers functionality to your application.
AngularJS also allows you to determine your own directives.

AngularJS Directives:

AngularJS directives extend attributes and ng- HTML prefix.
The ng application directive initializes an application AngularJS.
The init directive initializes ng data applications.

Example

<div ng-app="" ng-init="firstName='John'"><p>Name: <input type="text" ng-model="firstName"></p>

<p>You wrote: {{ firstName }}</p></div>

The ng-model directive binds the HTML controls (input, select, text area) for data applications.
Read about all the directives in AngularJS AngularJS our Reference Directive.
The union data

Data Binding:

The {{firstName}} expression, in the previous example, AngularJS data link expressions.
Data collected in AngularJS AngularJS binding expression data with AngularJS.
{{}} FirstName have joined with ng-model = "Name".
In the first two examples of the text field are linked with two ng-model directives:

Example 

<div ng-app="" ng-init="quantity=1;price=5">
Quantity: <input type="number" ng-model="quantity">
Costs:    <input type="number" ng-model="price">
Total in dollar: {{ quantity * price }}
</div>

 The ng application directive:

The application ng directive defines the root element of an application AngularJS.
The ng-application directive automatically bootstraps (initializes automatically) application when loading a web page.

The init ng directive

The init ng directive defines the value of the initial request of an AngularJS.
Usually, you will not init-ng. Who will use the driver or module instead?
You will learn more about the drivers and the modules later.

The ng-model Directive

The ng-model directive binds the HTML controls (input, select, text area) for data applications.
The ng-model directive can also:
• Provide validation for the data type of the application (number, email, is necessary).
• Provide a status for data applications (legal, dirty, flashy, error).
• Provide a CSS class for the HTML element.
• HTML elements together in an HTML form.
Read more about the ng-model directive in the next chapter.

Create new directives

In addition to all the built-in AngularJS directives, you can make your own directives.
New guidelines formulated by the use of the .directive function.
They are used in the new directive, so the HTML tag with the same name as the new directive.
If the directive name, you should use the name of the camels, w3TestDirective, but if you claim it, you have to make a name Separate, w3-test Directive:

Example

<body ng-app="myApp">

<w3-test-directive></w3-test-directive>

<script>

var app = angular.module("myApp", []);

app.directive("w3TestDirective", function() {

return 

}</script>

</body>

Restrictions

You can restrict your directives can only be invoked by several methods.
The legal limit value is:
• E is the name of the element
• One of the attributes
• Class C a
• M for Comment
The standard value is EA, it is both the name of the element and attribute names can be used in the Directive.

Comments

  1. http://angularjscoursesinstitute.blogspot.com/2018/09/angularjs-directives.html

    ReplyDelete
  2. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.MCSE Training in Chennai
    AI Training in Chennai
    SEO Training in Chennai

    ReplyDelete
  3. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.Dotnet Training in Chennai
    Matlab Training in Chennai
    Embedded Training in Chennai
    SAS Training in Chennai

    ReplyDelete
  4. You can download educational websites templates on TemplateMonster. Visit it right now!

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. AngularJS allows you to extend the HTML attributes with the new directives. Very clearly explained with Examples.
    Thanks for sharing an informative blog; I really enjoyed reading your well written articles.

    Lube Oil Blending Plant, Lube Oil and Grease Filling Line

    ReplyDelete

Post a Comment

Popular posts from this blog

Introduction to AngularJS