AngularJs Empty Element
home
Run
screen_rotation
fullscreen
cloud_download
<!DOCTYPE html> <html lang="en"> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"></script> <script> var myApp = angular.module("myApp", []); myApp.controller("myController", function($scope) { $scope.emptyElement = function() { var elmn = angular.element( document.querySelector( '#myDiv' ) ); elmn.empty(); }; }); </script> </head> <body> <div ng-app="myApp"> <div ng-controller="myController"> <input type="button" value="Empty Div " ng-click="emptyElement()"> <div id="myDiv" style="width:300px;height:400px;background:yellow"> <h3>Heading</h3> <p>Hello World!</p> </div> </div> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"></script> <script> var myApp = angular.module("myApp", []); myApp.controller("myController", function($scope) { $scope.emptyElement = function() { var elmn = angular.element( document.querySelector( '#myDiv' ) ); elmn.empty(); }; }); </script> </head> <body> <div ng-app="myApp"> <div ng-controller="myController"> <input type="button" value="Empty Div " ng-click="emptyElement()"> <div id="myDiv" style="width:300px;height:400px;background:yellow"> <h3>Heading</h3> <p>Hello World!</p> </div> </div> </body> </html>
Copyrights@tutorialsplane.com