Ng-Bind-Template-7

 

In this example of ng-bind-template, We are going to print the object properties in span element like and in js, we will define the customer object like: $scope.customer = { name: "Learn It", address: "2306/7 Sector 20 Chandigarh", email: "[email protected]" };

 
 
 
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> </head> <body ng-app="app"> <div ng-controller="controllerName"> <div class="container"> <span ng-bind-template="{{ customer.name}} {{ customer.address }} {{ customer.email }}"></span> </div> </div> <script> var app = angular.module("app", []); app.controller('controllerName', ['$scope', function ($scope) { $scope.customer = { name: "Learn It", address: "2306/7 Sector 20 Chandigarh", email: "[email protected]" }; }]); </script> </body> </html>
Output