Replace String in AngularJs
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.exampleString = "Hello World !"; $scope.myString = ''; $scope.replaceStr = function() { // get & replce the input value $scope.exampleString = $scope.exampleString.replace("World", $scope.myString); }; }); </script> </head> <body> <div ng-app="myApp"> <div ng-controller="myController"> Enter a value and click "Replace" Button to replace the - "World".<br> <input type="text" name="strExample" ng-model="myString"><br> <button ng-click='replaceStr()' >Replace</button><br> String = {{exampleString}}<br> </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.exampleString = "Hello World !"; $scope.myString = ''; $scope.replaceStr = function() { // get & replce the input value $scope.exampleString = $scope.exampleString.replace("World", $scope.myString); }; }); </script> </head> <body> <div ng-app="myApp"> <div ng-controller="myController"> Enter a value and click "Replace" Button to replace the - "World".<br> <input type="text" name="strExample" ng-model="myString"><br> <button ng-click='replaceStr()' >Replace</button><br> String = {{exampleString}}<br> </div> </div> </body> </html>
Copyrights@tutorialsplane.com