change Case of letters in a word through Angular JS..what is wrong with this code..Please guide me


  • 0
    M

    <!DOCTYPE html>

    <html> <head> <title>ALL_CAPS_PAGE</title> </head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <body>
    <div ng-app="myApp" ng-controller="changeCase">
    	<h2><p>ENTERED TEXT WILL BE CONVERTED TO UPPERCASE!</p></h2>
    	
    	<p>ENTER TEXT: <input type="string"  ng-model="word"></p>
                <button type="button" ng-click="convertIt()">convert</button>
    	<p> {{ wordz}} </p>
    	<p> {{showIt}} </p>
    </div>
    
    <script>
    	var app = angular.module('myApp',[]);
    	app.controller('changeCase',function($scope){
    		
    		$scope.showIt = function(){
    			
    			return $scope.word;
    		};
    		$scope.convertIt = function(){
    			
    			$scope.wordz = $scope.word.split();
    			for (i=0; i<wordz.length(); i++)
    			{
    			<div ng-if "wordz.charCodeAt(i)>64 && wordz.charCodeAt(i)<91" >
    			< wordz.charCodeAt(i) = wordz.charCodeAt(i) + 32 >
    			</div>
    			<div ng-if "wordz.charCodeAt(i)>96 && wordz.charCodeAt(i)<123" >
    			< wordz.charCodeAt(i) = wordz.charCodeAt(i) - 32 >
    			</div>
    			}
    			return $scope.wordz
    		};
    		
    	});
    	
    </script>
    
    </body> </html>

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.