angular-element-1

 

angular.element is very similar to jquery selectors and In this example we append html after a specific div See the code snippet:

 
 
 
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Welcome to LearnKode - A code learning platform</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> </head> <body ng-app="app"> <div ng-controller="elementController"> <div id="testDiv">{{name}}</div> </div> <script> var app = angular.module("app", []); app.controller('elementController', ['$scope', '$document', function ($scope, $document) { $scope.name = "LearnKode"; var element = angular.element($document[0].querySelector('#testDiv')); element.append("<p>Append</p>"); }]); </script> </body> </html>
Output