Validate CSV file in angularJs

I have a csv file which contains two columns store_id and store_name.When the user uploads a csv file I need to validate the file i.e check if first column is Integer(store_id) and second column is String(store_name).Can you help how to read and retrieve the content and validate the file?

Thanks

Answer

Try this code

my csv file

    store_id,store_name
01,"First point"
02,"Second point"
03,"Third point"

var demo = angular.module('demo', []);
demo.controller('loadData', function($scope,$rootScope,$http){
   $scope.uploadData = function() {
	   var uploaded=$scope.fileContent;
		$scope.processData(uploaded);
   };
   	$scope.processData = function(allData) {
		var filteredData = allData.split(/rn|n/);
		var headers = filteredData[0].split(',');
		var final = [];

		for ( var i = 0; i < filteredData.length; i++) {

		if (!filteredData[i]=="") {

			var data = filteredData[i+1].split(',');

			if (isNaN(data[0])==false && isNaN(data[1])==true) {
				final.push(data);
				console.log("Valid CSV");
			}
			else{
				console.log("Not Valid CSV");
			}
		}
		}
		$scope.data = final;
	};
});
demo.directive('fileReader', function() {
  return {
    scope: {
      fileReader:"="
    },
    link: function(scope, element) {
      $(element).on('change', function(changeEvent) {
        var files = changeEvent.target.files;
        if (files.length) {
          var r = new FileReader();
          r.onload = function(e) {
              var contents = e.target.result;
              scope.$apply(function () {
                scope.fileReader = contents;
              });
          };
          r.readAsText(files[0]);
        }
      });
    }
  };
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular.min.js"></script>
<div ng-app='demo'>
	<div ng-controller='loadData'>
	  <input type="file" file-reader="fileContent" />
	  <button ng-click='uploadData($event)' >upload</button>
      <div>{{fileContent}}</div>
	  <table>
		<tr ng-repeat="x in data">
		  <td ng-repeat="y in x">{{ y }}</td>
		</tr>
	  </table>
	</div>
	</div>