AngularJs remove spaces from string
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.myString1 = "Wel Com e"; $scope.myString2 = ""; $scope.removeSpace = function() { $scope.myString2 = $scope.myString1.replace(/ /g,""); }; }); </script> </head> <body> <div ng-app="myApp"> <div ng-controller="myController"> With Space = {{myString1}}<br> Without Space = {{myString2}}<br> <button ng-click='removeSpace()' >Remove Blank Space</button> </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.myString1 = "Wel Com e"; $scope.myString2 = ""; $scope.removeSpace = function() { $scope.myString2 = $scope.myString1.replace(/ /g,""); }; }); </script> </head> <body> <div ng-app="myApp"> <div ng-controller="myController"> With Space = {{myString1}}<br> Without Space = {{myString2}}<br> <button ng-click='removeSpace()' >Remove Blank Space</button> </div> </div> </body> </html>
Copyrights@tutorialsplane.com