Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var lmApp = angular.module('lmApp', []);
- lmApp.service('StudentService', function() {
- this.stuIndex = [
- {
- id: 1,
- grade: 9,
- profile: {
- firstName:'Adam',
- lastName: 'Smith'
- }
- },
- {
- id: 2,
- grade: 4,
- profile: {
- firstName:'Billie',
- lastName: 'Holiday'
- }
- },
- {
- id: 3,
- grade: 0,
- profile: {
- firstName:'Peter',
- lastName: 'Hootinanny'
- }
- },
- {
- id: 4,
- grade: 8,
- profile: {
- firstName:'Jimmy',
- lastName: 'Joejoe'
- }
- },
- {
- id: 5,
- grade: 1,
- profile: {
- firstName:'Sam',
- lastName: 'Samson'
- }
- },
- {
- id: 6,
- grade: 2,
- profile: {
- firstName:'Steve',
- lastName: 'Rider'
- }
- },
- {
- id: 7,
- grade: 9,
- profile: {
- firstName:'Wally',
- lastName: 'Wilkinson'
- }
- },
- {
- id: 8,
- grade: 9,
- profile: {
- firstName:'June',
- lastName: 'Jepster'
- }
- },
- {
- id: 9,
- grade: 9,
- profile: {
- firstName:'Amy',
- lastName: 'Cider'
- }
- },
- {
- id: 10,
- grade: 9,
- profile: {
- firstName:'Cindy',
- lastName: 'Sojourn'
- }
- }
- ];
- return this.stuIndex;
- });
- ////////////////////////////////
- ////////// STEP TWO ////////////
- // BEGINS BUILDING CONTROLLER //
- ////////////////////////////////
- lmApp.controller('studentController', ['$scope', 'StudentService', function($scope, StudentService){
- $scope.studentList = StudentService;
- $scope.predicate = 'id';
- $scope.reverse = false;
- $scope.order = function(predicate) {
- $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;
- $scope.predicate = predicate;
- };
- }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement