Ng-Bind-Template-6

 

In this example, We are creating span html using ng-repeat and binding span tag ng-bind-template. This will print output as: 1. Visrosoftware Panchkula! 2. Visrosoftware Panchkula! 3. Visrosoftware Panchkula!

 
 
 
<!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"> <label> Company Name: <input class="form-control" type="text" ng-model="cName"><br> </label> <label> Location: <input class="form-control" type="text" ng-model="location"><br> </label> <div ng-repeat="key in counter"> <p><span ng-bind-template="{{key}}. {{cName}} {{location}}!"></span></p> </div> </div> </div> <script> var app = angular.module("app", []); app.controller('controllerName', ['$scope', function ($scope) { $scope.cName = 'Visrosoftware'; $scope.location = 'Panchkula'; $scope.counter = ['1', '2', '3']; }]); </script> </body> </html>
Output