« Previous Page Next Page »
    

Introduction to AngularJs Directives.

POSTED

AUTHOR: VARUN SINGH

AngularJs Directives - In this tutorial, you will learn AngularJs Directives. In AngularJs has a set of built-in directives which offers functionality to your applications. Some directive like ng-app initializes an AngularJS application, ng-init initializes application data, ng-model binds the input data to application data.


AngularJs Directives


AngularJS directives are extended HTML attributes with the prefix ng-.

The ng-app directive initializes an AngularJS application.

The ng-init directive initializes application data.

The ng-model directive binds the value of HTML controls (input, select, textarea) to application data.

Example:

<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body>

<div ng-app="" ng-init="firstName='Varun'">

<p>Input something in the input box:</p>
<p>Name: <input type="text" ng-model="firstName"></p>
<p>You wrote: {{ firstName }}</p>

</div>

</body>
</html>

Try it Yourself



Try it Yourself

The End:

Thank you for reading this article, and if you have any problem, have a another better useful solution about this article, please write message in the comment section. We will be very happy to hear that.

If you like my tutorial, please follow us on facebook, Google + and Twitter. I need your support to continue.




« Previous Page Next Page »

Comments: