Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

docs(README): Fixed type and punctuation #215

Closed
wants to merge 14 commits into from
Closed
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
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ The full tutorial can be found at http://docs.angularjs.org/tutorial.

### Git

- A good place to learn about setting up git is [here][git-github]
- Git [home][git-home] (download, documentation)
- A good place to learn about setting up git is [here][git-github].
- Git [home][git-home] (download, documentation).

### Node.js and Tools

- Get [Node.js][node-download].
- Install the tool dependencies (`npm install`)
- Install the tool dependencies (`npm install`).


## Workings of the application

- The application filesystem layout structure is based on the [angular-seed] project.
- There is no dynamic backend (no application server) for this application. Instead we fake the
an application server by fetching static json files.
application server by fetching static json files.
- Read the Development section at the end to familiarize yourself with running and developing
an angular application.

Expand All @@ -41,8 +41,8 @@ To see the changes which between any two lessons use the git diff command.

### step-0

- Add ngApp directive to bootstrap the app
- Add simple template with an expression
- Add ngApp directive to bootstrap the app.
- Add simple template with an expression.


### step-1
Expand All @@ -54,12 +54,12 @@ To see the changes which between any two lessons use the git diff command.
### step-2

- Convert the static html list into dynamic one by:
- creating `PhoneListCtrl` controller for the application
- creating `PhoneListCtrl` controller for the application.
- extracting the data from HTML, moving it into the controller as an in-memory dataset.
- converting the static HTML document into an Angular template with the use of the `ngRepeat`
directive which iterates over the dataset of phones.
`ngRepeat` clones its contents for each instance in the dataset and renders it into the view.
- Add a simple unit test to show off how to write tests and run them with Karma
- Add a simple unit test to show off how to write tests and run them with Karma.


### step-3
Expand Down
97 changes: 97 additions & 0 deletions app/css/animations.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
* animations css stylesheet
*/

/* animate ngRepeat in phone listing */

.phone-listing.ng-enter,
.phone-listing.ng-leave,
.phone-listing.ng-move {
-webkit-transition: 0.5s linear all;
-moz-transition: 0.5s linear all;
-o-transition: 0.5s linear all;
transition: 0.5s linear all;
}

.phone-listing.ng-enter,
.phone-listing.ng-move {
opacity: 0;
height: 0;
overflow: hidden;
}

.phone-listing.ng-move.ng-move-active,
.phone-listing.ng-enter.ng-enter-active {
opacity: 1;
height: 120px;
}

.phone-listing.ng-leave {
opacity: 1;
overflow: hidden;
}

.phone-listing.ng-leave.ng-leave-active {
opacity: 0;
height: 0;
padding-top: 0;
padding-bottom: 0;
}

/* cross fading between routes with ngView */

.view-container {
position: relative;
}

.view-frame.ng-enter,
.view-frame.ng-leave {
background: white;
position: absolute;
top: 0;
left: 0;
right: 0;
}

.view-frame.ng-enter {
-webkit-animation: 0.5s fade-in;
-moz-animation: 0.5s fade-in;
-o-animation: 0.5s fade-in;
animation: 0.5s fade-in;
z-index: 100;
}

.view-frame.ng-leave {
-webkit-animation: 0.5s fade-out;
-moz-animation: 0.5s fade-out;
-o-animation: 0.5s fade-out;
animation: 0.5s fade-out;
z-index: 99;
}

@keyframes fade-in {
from { opacity: 0; }
to { opacity: 1; }
}
@-moz-keyframes fade-in {
from { opacity: 0; }
to { opacity: 1; }
}
@-webkit-keyframes fade-in {
from { opacity: 0; }
to { opacity: 1; }
}

@keyframes fade-out {
from { opacity: 1; }
to { opacity: 0; }
}
@-moz-keyframes fade-out {
from { opacity: 1; }
to { opacity: 0; }
}
@-webkit-keyframes fade-out {
from { opacity: 1; }
to { opacity: 0; }
}

98 changes: 98 additions & 0 deletions app/css/app.css
Original file line number Diff line number Diff line change
@@ -1 +1,99 @@
/* app css stylesheet */

body {
padding-top: 20px;
}


.phone-images {
background-color: white;
width: 450px;
height: 450px;
overflow: hidden;
position: relative;
float: left;
}

.phones {
list-style: none;
}

.thumb {
float: left;
margin: -0.5em 1em 1.5em 0;
padding-bottom: 1em;
height: 100px;
width: 100px;
}

.phones li {
clear: both;
height: 115px;
padding-top: 15px;
}

/** Detail View **/
img.phone {
float: left;
margin-right: 3em;
margin-bottom: 2em;
background-color: white;
padding: 2em;
height: 400px;
width: 400px;
display: none;
}

img.phone:first-child {
display: block;
}


ul.phone-thumbs {
margin: 0;
list-style: none;
}

ul.phone-thumbs li {
border: 1px solid black;
display: inline-block;
margin: 1em;
background-color: white;
}

ul.phone-thumbs img {
height: 100px;
width: 100px;
padding: 1em;
}

ul.phone-thumbs img:hover {
cursor: pointer;
}


ul.specs {
clear: both;
margin: 0;
padding: 0;
list-style: none;
}

ul.specs > li{
display: inline-block;
width: 200px;
vertical-align: top;
}

ul.specs > li > span{
font-weight: bold;
font-size: 1.2em;
}

ul.specs dt {
font-weight: bold;
}

h1 {
border-bottom: 1px solid gray;
}
22 changes: 19 additions & 3 deletions app/index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
<!doctype html>
<html lang="en">
<html lang="en" ng-app="phonecatApp">
<head>
<meta charset="utf-8">
<title>My HTML File</title>
<title>Google Phone Gallery</title>
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="css/app.css">
<link rel="stylesheet" href="css/animations.css">

<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-animate/angular-animate.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="js/app.js"></script>
<script src="js/animations.js"></script>
<script src="js/controllers.js"></script>
<script src="js/filters.js"></script>
<script src="js/services.js"></script>
</head>
<body>

<div class="view-container">
<div ng-view class="view-frame"></div>
</div>

</body>
</html>
</html>
52 changes: 52 additions & 0 deletions app/js/animations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
var phonecatAnimations = angular.module('phonecatAnimations', ['ngAnimate']);

phonecatAnimations.animation('.phone', function() {

var animateUp = function(element, className, done) {
if(className != 'active') {
return;
}
element.css({
position: 'absolute',
top: 500,
left: 0,
display: 'block'
});

jQuery(element).animate({
top: 0
}, done);

return function(cancel) {
if(cancel) {
element.stop();
}
};
}

var animateDown = function(element, className, done) {
if(className != 'active') {
return;
}
element.css({
position: 'absolute',
left: 0,
top: 0
});

jQuery(element).animate({
top: -500
}, done);

return function(cancel) {
if(cancel) {
element.stop();
}
};
}

return {
addClass: animateUp,
removeClass: animateDown
};
});
25 changes: 25 additions & 0 deletions app/js/app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
'use strict';

/* App Module */

var phonecatApp = angular.module('phonecatApp', [
'ngRoute',
'phonecatAnimations',

'phonecatControllers',
'phonecatFilters',
'phonecatServices'
]);

phonecatApp.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/phones', {
templateUrl: 'partials/phone-list.html',
controller: 'PhoneListCtrl'
}).
when('/phones/:phoneId', {
templateUrl: 'partials/phone-detail.html',
controller: 'PhoneDetailCtrl'
}).
otherwise({
redirectTo: '/phones'
});
}]);
19 changes: 19 additions & 0 deletions app/js/controllers.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
'use strict';

/* Controllers */

var phonecatControllers = angular.module('phonecatControllers', []);

phonecatControllers.controller('PhoneListCtrl', ['$scope', 'Phone',
function($scope, Phone) {
$scope.phones = Phone.query();
$scope.orderProp = 'age';
}]);

phonecatControllers.controller('PhoneDetailCtrl', ['$scope', '$routeParams', 'Phone',
function($scope, $routeParams, Phone) {
$scope.phone = Phone.get({phoneId: $routeParams.phoneId}, function(phone) {
$scope.mainImageUrl = phone.images[0];
});

$scope.setImage = function(imageUrl) {
$scope.mainImageUrl = imageUrl;
}
}]);
6 changes: 6 additions & 0 deletions app/js/filters.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
'use strict';

/* Filters */

angular.module('phonecatFilters', []).filter('checkmark', function() {
return function(input) {
return input ? '\u2713' : '\u2718';
};
});
Loading