AngularJS

Directives of AngularJS

Share

To extend html, AngularJS directives are used. Now We will discuss following directives:

List of directives:

ng-app : Directives of AngularJS that defines and links an AngularJS application to HTML. It defines the root element.

<div ng-app="">
...
</div>

ng-init : To initializes application data. It is used to define values to the variables which is to be used in the application.

<div ng-app="" ng-init="countries=[{id:'1',name:'Alaska'},
{id:'2',name:'Alabama'},
{id:'3',name:'Germany'}]">

...
</div>

ng-model : Directive that binds the values of AngularJS application data to HTML input controls. Here we’ve defined a model named “name”.

<div ng-app="">
...
<p>Your Name: <input type="text" ng-model="name"></p>
</div>

ng-repeat : Directive that repeats html elements for each iteration.

<div ng-app="">
...
<p>Country list:</p>
<ol>
<li ng-repeat="country in countries">
{{ 'ID: ' + country.id + ', Name: ' + country.name }}
</li>
</ol>
</div>

Recent Posts

The Rise of NFTs: Exploring the Impact of Non-Fungible Tokens on the Digital Economy

NFTs, or Non-Fungible Tokens, are revolutionizing the digital economy. These unique digital assets, authenticated through…

7 hours ago

Unveiling the Truth: Is the Spread of Sinus Infections a Myth or Reality?

Sinus infections, impacting approximately 31 million Americans each year, represent a significant health concern stemming…

1 day ago

Best Exercises To Reduce Weight & Keep You Stronger & Fitter!

No doubt that balanced weight is the key to wellness. So, when it comes to…

1 day ago

ARTIFICIAL INTELLIGENCE: Advantages And Disadvantages? Everything You Need to Know

Pros And Cons Of AI: Artificial Intelligence directly translates to conceptualizing and building machines that…

2 days ago

Four common mistakes when picking an internet provider

We all live on the internet; we use it for everything. Thus, when it comes…

2 days ago

What Is Commonly Misdiagnosed as Pink Eye: Understanding Eye Conditions and Their Symptoms

Introduction: Pink eye, or conjunctivitis, is a common eye condition characterized by redness and inflammation…

2 days ago