Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.1/angular.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body ng-controller="MyController">
 <h3>Original String : {{originalString}}</h3>
 <h3>Reverse String : {{reverseString}}</h3>
 <h3>Character Count : {{characterCount}}</h3>
</body>
</html>
var myApp= angular.module("myApp",[]);
myApp.factory("StringUtil",function(){
  return{
    getReverseString : function(inputString){
      return inputString.split("").reverse().join("");
    },
    getCharacterCount : function(inputString){
      return inputString.length;
    }
  };
});
myApp.controller("MyController",
  ["$scope", "StringUtil", function($scope, StringUtil){
   $scope.originalString ="Sandeep Kumar Patel";
   $scope.reverseString = StringUtil.getReverseString($scope.originalString);
   $scope. characterCount = StringUtil.getCharacterCount($scope.originalString);
}]);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
saan1984pro
0viewers