Angular multiple - ASCII\with test data

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 (math):(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>
  <h2>
  Sorted Result
  </h2>
    <ul>
      <li ng-repeat="material in materials | asciiSort">
        {{ material.name}} , {{material.edition}}
      </li>
    </ul>
<!--     <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;
}

JavaScript

var app = angular.module('sample', []);
app.controller('materialController', function($scope) {
  $scope.materials = [];
    
  function getMaterials() {
    $scope.materials = 
    [{
    	name: '0134310993',
      edition:'2e'
    },
    {
    	name: 'Algebra & Trigonometry, Second Custom Edition for Tidewater Community College',
      edition:'2e'
    },
    {
    	name: 'Algebra and Statistics, Second Custom Edition for Jackson Community College; MATH 033',
      edition:'2e'
    },
    {
    	name: 'Algebra and Trigonometry with Modeling and Visualization, Fourth Custom Edition for Oregon State University',
      edition:'1e'
    },
    {
    	name: 'Algebra for College Students, A Custom Edition for the University of Nevada Reno',
      edition:'1e'
    },
    {
    	name: 'Algebra, Functions, and Modeling, Custom Edition for Jefferson Community College',
      edition:'2e'
    },
    {
    	name: 'Applied Statistics, Custom Edition for Middle Tennessee State University MATH 1530K',
      edition:'1e'
    },
    {
    	name: 'Basic College Mathematics, Custom Edition for Morton College',
      edition:'3e'
    },
    {
    	name: 'Basic Math, Introductory and Intermediate Algebra',
      edition:'2e'
    },
    {
    	name: 'Basic Math, Introductory and Intermediate Algebra, 1/e Ready To Go MyMathLab Course',
      edition:'1e'
    },
    {
    	name: 'Basic, Beginning and Intermediate Algebra, Custom Edition for St. Louis Community Colleg',
      edition:'1e'
    },
    {
    	name: 'Beginning & Intermediate Algebra, Custom Edition for Colorado Mesa University',
      edition:'1e'
    },
    {
    	name: 'College Algebra in Context with Applications for the Managerial, Life, and Social Sciences, Georgia State University Third Custom Edition',
      edition:'1e'
    },
    {
    	name: 'College Algebra, Third Custom Edition for Concordia University',
      edition:'2e'
    },
    {
    	name: 'Dev Math Modules',
      edition:'2e'
    },
    {
    	name:...