Angular multiple - ASCII\with test data\multiple columns

by Harsha Jayamanna

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular.js"></script>
<script src=" https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js"></script>
<div ng-app="sample">
  <div ng-controller="materialController">
  <h1>
  Method 3:(ASCII)
  </h1>
  <p>
  Using a sort rule which was inherited from  ASCII sort. This rule doesn’t sort capital letters before lowercase letters., instead it considers only the alphabetical order when sorting letters.
  </p>
  <h2>
  Original Result
  </h2>
    <ul>
      <li ng-repeat="material in materials">
        {{ material.name}} , {{ material.edition}}
      </li>
    </ul>
    <a href="https://docs.google.com/spreadsheets/d/1rNUzh_EHI05pbGXPmITe3_u6NJst2ua4P7KR41WIVD0/edit#gid=0" target="_blank">Link to the data set</a>
  <h2>
  Sorted Result
  </h2>
    
    <table>
    <tr>
      <td>Sorted order</td>
      <td>Preferred Order???</td>
      <td>Textbook Title</td>
      <td>Textbook Edition</td>
      <td>Author(s)</td>
      <td>Sub-Series</td>
      <td>Edition Geography</td>
    </tr>
    <tr ng-repeat="material in materials | asciiSort">
      <td>{{$index+1}}</td>
      <td>{{ material.order}}</td>
      <td>{{ material.name}}</td>
      <td>{{material.edition}}</td>
      <td> {{material.author}}</td>
      <td>{{material.subSeries}}</td>
      <td>{{material.geo}}</td>
    </tr>
    </table>
<!--     <h2>
      Angular default Sorting
      </h2>
    <ul>
      <li ng-repeat="material in materials | orderBy : ['name','-edition']">
        {{ material.name}} , {{material.edition}}
      </li>
    </ul> -->
  </div>
</div>

CSS

body {
  font-family: Arial;
}

td{
  border : 1px solid;
}

JavaScript

var app = angular.module('sample', []);
app.controller('materialController', function($scope) {
  $scope.materials = [];
    
  function getMaterials() {
    $scope.materials = 
    [{
    	order : '1',
    	name: 'Algebra and Trigonometry',
      edition:'2e',
      author : 'Trigsted, Kirk',
      subSeries: '',
      geo :''
    },
    {
    	order : '4',
    	name: 'Algebra and Trigonometry',
      edition:'2e',
      author : 'Trigsted, Kirk',
      subSeries: '',
      geo :'Canadian'
    },
    {
    	order : '2',
    	name: 'Algebra and Trigonometry',
      edition:'2e',
      author : 'Trigsted, Kirk',
      subSeries: 'AP',
      geo :''
    },
    {
    	order : '3',
    	name: 'Algebra and Trigonometry',
      edition:'2e',
      author : 'Trigsted, Kirk',
      subSeries: 'Ready to Go',
      geo :''
    },
    {
    	order : '5',
    	name: 'Algebra and Trigonometry',
      edition:'2e',
      author : 'Trigsted, Kirk',
      subSeries: 'Ready to Go',
      geo :'Australian'
    },
    {
    	order : '6',
    	name: 'Basic Mathematics, Beginning Algebra, and Intermediate Algebra',
      edition:'1e',
      author : 'Bodden Kevin | Gallagher, Randall | Trigsted, Kirk',
      subSeries: 'Ready to Go',
      geo :''
    },
    {
    	order : '7',
    	name: 'Beginning Algebra',
      edition:'1e',
      author : 'Bodden Kevin | Gallagher, Randall | Trigsted, Kirk',
      subSeries: '',
      geo :''
    },
    {
    	order : '8',
    	name: 'Beginning and Intermediate Algebra',
      edition:'2e',
      author : 'Gallagher, Randall | Trigsted, Kirk',
      subSeries: '',
      geo :''
    },
    {
    	order : '9',
    	name: 'Beginning and Intermediate Algebra',
      edition:'1e',
      author : 'Bodden Kevin | Gallagher, Randall | Trigsted, Kirk',
      subSeries: '',
      geo :''
    },
    {
    	order : '10',
    	name: 'College Algebra',
      edition:'3e',
      author : 'Trigsted, Kirk',
      subSeries: '',
      geo :''
    },
    {
   ...