You can use the ng-bind directive, which will bind the innerHTML of the element to the specified model property:

Method 1

	<p ng-bind="demo_var"></p>

Method 2

	<p>First name: {{firstname}}</p>

Complete Example

<!DOCTYPE html>
<script src=""></script>

<div ng-app="myApp" ng-controller="myCtrl">
    <p ng-bind="firstName"></p>
    <p>{{ lastName }}</p>

var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
    $scope.firstName = "Coderz";
    $scope.lastName = "Heaven";    

<p>Use the ng-bind directive to bind the innerHTML of an element to a property in the data model.</p>


Leave a Reply

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




Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.