Guruji Point - Code You Want To Write

  • Home
  • Asp.Net
  • WCF
  • SQL
  • Type Script
  • AngularJS
  • Tech News
  • Blog
  • Earn Online

Sunday, 25 June 2017

Binding Data To An HTML In AngularJS

 angularjs     No comments   


Introduction
In this article we will learn how to bind content To html using angular attributes. Here we learn bind content using ng-bind-html attribute of angular. Direct binding of Angular Text to Html .

Previous Updates
In previous articles we have learnt Read Write connection string from web.config file.  EncryptByPassPhrase and DecryptByPassphrase  function in Sql  Base64 Encoding And Decoding In SQL Server. AngularJS vs JavaScript Example.

Bind Content To Html 

We can bind the data to Html page using ng-bind-html Attribute and also with the simple binding without any attribute.
In below example we can see angular attributes like ng-app, ng-controller,  ng-bind-html.
Below both bindings are used to display data into Html form. In simple Binding we only use
the {{ }} for define the variable which contains the data.
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-sanitize.js"></script>
    <script>
        var app = angular.module("myApp", ['ngSanitize']);
        app.controller("DemoAgCtrl", function ($scope) {
            $scope.msg = "This is Angular Binding Example.";
        });
    </script>
</head>
<body>
    <div ng-controller="DemoAgCtrl">
        <h3>Using Direct Binding </h3>  {{msg}}
        <h3>Using ng-bind-html Attribute </h3><p ng-bind-html="msg"></p>
    </div>
</body>
</html>

Output :-





  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home
View mobile version

0 comments:

Post a Comment

Facebook Updates

Guruji Point

Categories

Comman table Expression in SQL Dynamic Grid Row IQueryable in c# Learn AngularJS Scope_Identity() Use of indexes comma seperated string in sql row_number() and dense_rank() salary table structure. while loop in sql why do we need cursor why tuple used

About Us

This blog is about the Programming ,Tech News and some intresting facts related Contents. Here you can find fundamental and expert level topic of programming languages very practically related to C# , Asp.Net ,Sql-Server, JavaScript, Jquery, WebServices And also Web-Api, WCF ,WPF, Angular Js.

Contact Us

Email Us - gurujipoints@gmail.com
Contact- 8077657477

Reach Us

Copyright © Guruji Point - Code You Want To Write