Angular ng init directive Example

Angular ng init directive Example

Today, We want to share with you Angular ng init directive Example.
In this post we will show you Angular ng init directive Example, hear for Angular ng init directive Example we will give you demo and example for implement.
In this post, we will learn about Angular ng init directive Example with an example.

AngularJS: scope of ng-init directive

The ng-init directive attribute allows you to all evaluate scope to an expression in the simple current scope in angular.

The ng-init directive Simple initializes app’s data.

The ng-init directive Basic defines load to initial values for an AngularJS App’s.

READ :  ASP.NET UpdateProgress control Tutorial with Examples

Syntax of the ng-init directive

 ....something code

Usage of ng-init directive

<div>  
<h1>{{myText}}</h1>  
<p>The ng-init Simple directive has created an AngularJS variable to used App's, which can be used in the Singal page application.</p>  

index.html


  
    <title>AngularJS infinityknow.com</title>
	<a href="https://infinityknow.com/libs/angular.min.js">https://infinityknow.com/libs/angular.min.js</a>
    <a href="http://app.js">http://app.js</a>
  
  
    <div>
      <a href="">2012</a> |  <a href="">2013</a>
      <div>Showing {{ model.newyear }}</div>
      <hr />
    </div>
    <div>
      <a href="">2012</a> |  <a href="">2013</a>
      <div>Showing {{ model.newyear }}</div>
    </div>
  



app.js

var myapp = angular.module('infinityknowApp', []);

myapp.controller('myController', function($scope) {
  
});

Example : 2 Basic Expression of the ng-init demo

index.html


<a href="https://infinityknow.com/libs/angular.min.js">https://infinityknow.com/libs/angular.min.js</a>


<div>
  <p> <mark>{{ 5 + 5 }}</mark></p>
  <hr />
  <p></p>
  <hr />
  <p>{{ qty * cprice }}</p>
</div>



Add a Comment

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