Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting #2

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions GruntFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ module.exports = function (grunt)
separator: "\n\n"
},
dist: {
src: [],
dest: 'src/resources/js/<%= pkg.name %>.js'
src: ['src/resources/js/**.js'],
dest: 'src/<%= pkg.name %>.js'
},
deps: {
src: [
Expand All @@ -17,13 +17,17 @@ module.exports = function (grunt)
'bower_components/bootstrap/dist/js/bootstrap.js',
'bower_components/angularjs/angular.min.js',
],
dest: 'src/resources/js/<%= pkg.name %>-deps.js'
dest: 'src/<%= pkg.name %>-deps.js'
},
css: {
src: ['bower_components/bootstrap/dist/css/bootstrap.min.css',
'src/resources/css/styles.css'
],
dest: 'src/resources/css/<%= pkg.name %>.css'
dest: 'src/<%= pkg.name %>.css'
},
map: {
src: ['bower_components/angularjs/angular.min.js.map'],
dest: 'src/angular.min.js.map'
}
},

Expand Down
16 changes: 4 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Accio Code Tutorials: AngularJS#

***Updated: 11-22-14***

This tutorial series for [AccioCode](https://www.youtube.com/user/CDPAdvertising "Accio Code on YouTube") will show how to use the basics of AngularJS. You will learn how to make a simple web page and a simple web application.

Expand All @@ -9,14 +8,7 @@ AngularJS is an open-source framework in JavaScript. It was created and maintain

It is an MVC (Model-View-Controller) framework so a brief understanding of MVC is suggested, but not required, to use this tutorial.

## Course Videos ##
1. [Setting up AngularJS Workspace](https://www.youtube.com/watch?v=ofASsumsf7E "Setting up AngularJS Workspace on YouTube")
2. [Simple Data Binding with AngularJS](https://www.youtube.com/watch?v=ia_vAGm_PCQ "Simple Data Binding with AngularJS")
3. [An Introduction to Controllers](https://www.youtube.com/watch?v=IGy2c-XwXgI "An Introduction to Controllers")
4. [Writing Our First Directive](http://youtu.be/QwaVgz-GSXY "Writing our First Directive")
5. [Scope, Element and Attributes](http://youtu.be/utKtjxLako4 "Scope, Element and Attributes")
6. [Directive Element Binding](http://youtu.be/7vgvBffpSbs "Directive Element Binding")
7. [Directive to Directive Communication](http://youtu.be/aG8VD0KvUw4 "Directive to Directive Communication")
8. [Directive Restrictions Explained](http://youtu.be/mkEJDWneiPg "Directive Restrictions Explained")
9. [Isolate Scope Part 1](https://www.youtube.com/watch?v=-a4E2eRHHVY "Isolate Scope Part 1")
10. [Isolate Scope Part 2](http://youtu.be/UMoDVY8HAVk "Isolate Scope Part 2")
## Sorting and Filtering Course Videos ##
1. [Services and JSON](http://youtu.be/rHmk0UhJSb4 "Services and JSON")
2. [Ng-Repeat](http://youtu.be/CqaoKt1Gvyk "Ng-Repeat")
3. [Filters and Sorting](http://youtu.be/7nOcg6SPspI "Filters and Sorting")
8 changes: 8 additions & 0 deletions src/angular.min.js.map

Large diffs are not rendered by default.

File renamed without changes.
26 changes: 26 additions & 0 deletions src/angularjstutorial.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* use strict */
var app = angular.module("RavensApp", []);

app.service("ravensService", function ($http, $q)
{
var deferred = $q.defer();
$http.get('resources/json/BaltimoreRavens.json').then(function (data)
{
deferred.resolve(data);
});

this.getPlayers = function ()
{
return deferred.promise;
}
})

.controller("ravensCtrl", function ($scope, ravensService)
{
var promise = ravensService.getPlayers();
promise.then(function (data)
{
$scope.players = data.data;
console.log($scope.players);
});
})
34 changes: 27 additions & 7 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
<!doctype html>
<html lang="en">
<head>
<title>AccioCode AngularJS Tutorial</title>
<title>AccioCode AngularJS Tutorial - Sorting and Filtering and Ng-Repeat</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-COMPATIBLE" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, user-scalable=no">
<script src="resources/js/angularjstutorial-deps.js"></script>
<script src="resources/js/angularjstutorial.js"></script>
<script src="angularjstutorial-deps.js"></script>
<script src="angularjstutorial.js"></script>

<link rel="stylesheet" href="resources/css/angularjstutorial.css">
<link rel="stylesheet" href="angularjstutorial.css">
</head>
<body>

<div class="mainContainer">
<h1>AngularJS Tutorial</h1>
<button class="btn btn-default">Here we go</button>
<div class="mainContainer" data-ng-app="RavensApp">
<h1>Baltimore Ravens</h1>

<input type="text" data-ng-model="search.$">

<div data-ng-controller="ravensCtrl">
<table class="table table-striped">
<thead>
<tr>
<th>Player</th>
<th>Position</th>
<th>Number</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="player in players | filter:search | orderBy:'name' | limitTo: 3">
<td>{{player.name}}</td>
<td>{{player.position}}</td>
<td>{{player.number}}</td>
</tr>
</tbody>
</table>
</div>
</div>

</body>
Expand Down
Empty file.
1 change: 0 additions & 1 deletion src/resources/js/binding.js

This file was deleted.

25 changes: 25 additions & 0 deletions src/resources/js/ravensService.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* use strict */
var app = angular.module("RavensApp", []);

app.service("ravensService", function ($http, $q)
{
var deferred = $q.defer();
$http.get('resources/json/BaltimoreRavens.json').then(function (data)
{
deferred.resolve(data);
});

this.getPlayers = function ()
{
return deferred.promise;
}
})

.controller("ravensCtrl", function ($scope, ravensService)
{
var promise = ravensService.getPlayers();
promise.then(function (data)
{
$scope.players = data.data;
});
})
112 changes: 112 additions & 0 deletions src/resources/json/BaltimoreRavens.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
[
{
"name": "Joe Flacco",
"position": "Quarterback",
"number": 5
},
{
"name": "Steve Smith Sr.",
"position": "Wide Receiver",
"number": 89
},
{
"name": "Marlon Brown",
"position": "Wide Receiver",
"number": 14
},
{
"name": "Terrence Cody",
"position": "Nose Tackle",
"number": 62
},
{
"name": "Chris Canty",
"position": "Defensive Lineman",
"number": 99
},
{
"name": "Owen Daniels",
"position": "Tight End",
"number": 81
},
{
"name": "Elvis Dumervil",
"position": "Outside Linebacker",
"number": 58
},
{
"name": "Justin Forsett",
"position": "Running Back",
"number": 29
},
{
"name": "Gino Gradkowski",
"position": "Guard/Center",
"number": 66
},
{
"name": "Lawrence Guy",
"position": "Defensive Tackle",
"number": 67
},
{
"name": "Will Hill",
"position": "Free Safety",
"number": 33
},
{
"name": "Timmy Jernigan",
"position": "Defensive Tackle",
"number": 97
},
{
"name": "Jacoby Jones",
"position": "Wide Receiver / Returns",
"number": 12
},
{
"name": "Sam Koch",
"position": "Punter",
"number": 4
},
{
"name": "Anthony Levine",
"position": "Safety",
"number": 41
},
{
"name": "Albert McClellan",
"position": "Linebacker",
"number": 50
},
{
"name": "Pernell McPhee",
"position": "Outside Linebacker",
"number": 90
},
{
"name": "Rashaan Melvin",
"position": "Cornerback",
"number": 38
},
{
"name": "Eugene Monroe",
"position": "Tackle",
"number": 60
},
{
"name": "C.J. Mosley",
"position": "Inside Linebacker",
"number": 57
},
{
"name": "Terrell Suggs",
"position": "Outside Linebacker",
"number": 55
},
{
"name": "Justin Tucker",
"position": "Kicker",
"number": 9
}
]