Skip to content

Commit 941ce5b

Browse files
Merge pull request #13 from TheHalcyonSavant/master
trivial fixes part 1
2 parents 609c2f5 + 78bc58f commit 941ce5b

File tree

7 files changed

+10
-11
lines changed

7 files changed

+10
-11
lines changed

1820EN_03_Code/05 - promise api/promises.spec.js

-5
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ describe('pizza pit', function () {
7979

8080
it('should illustrate promise rejection', function () {
8181

82-
pizzaPit = new Restaurant($q, $rootScope);
8382
var pizzaDelivered = pizzaPit.takeOrder('Capricciosa');
8483
pizzaDelivered.then(pawel.eat, pawel.beHungry);
8584

@@ -100,10 +99,6 @@ describe('pizza pit', function () {
10099

101100
it('should illustrate successful promise chaining', function () {
102101

103-
var slice = function(pizza) {
104-
return "sliced "+pizza;
105-
};
106-
107102
pizzaPit.takeOrder('Margherita').then(slice).then(pawel.eat);
108103

109104
pizzaPit.deliverOrder();

1820EN_03_Code/07 - resource/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<button ng-click="add()">Add new user - class level</button>
1212
<ul>
1313
<li ng-repeat="user in users">
14-
<a ng-click="remove(user)">{{user}} - {{user.getFullName()}}</a>
14+
<a ng-click="remove(user,$index)">{{user}} - {{user.getFullName()}}</a>
1515
</li>
1616
</ul>
1717
</body>

1820EN_03_Code/07 - resource/resource.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ angular.module('resource', ['ngResource'])
1717
console.log($scope.users.length);
1818
});
1919

20-
$scope.remove = function (user) {
20+
$scope.remove = function (user, index) {
2121
Users['delete']({}, user);
2222
//user.$delete();
23+
$scope.users.splice(index, 1);
2324
};
2425

2526
$scope.add = function () {
@@ -36,4 +37,4 @@ angular.module('resource', ['ngResource'])
3637
Users.save(user);
3738
};
3839

39-
});
40+
});

1820EN_04_Code/08 -filters - array filters full example/arrayFilters.js

+3
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ angular.module('arrayFilters', [])
5353
}
5454
});
5555

56+
$scope.criteria = '';
57+
$scope.pageNo = 0;
58+
5659
$scope.setActivePage = function (pageNo) {
5760
if (pageNo >=0 && pageNo < $scope.pages.length) {
5861
$scope.pageNo = pageNo;

1820EN_09_Code/02_button_directive/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html ng-app="directives">
2+
<html ng-app="button-directive">
33
<head>
44
<meta charset="utf-8">
55
<title>AngularJS Book - Chapter 9 - Button Directive</title>

1820EN_09_Code/04_validate-equals_directive/directive.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ describe('validateEquals directive', function() {
5454
expect(modelValue.testValue).toBe(undefined);
5555
});
5656

57-
it('should be invalid if the input value changes to be the same as the reference', function() {
57+
it('should be valid if the input value changes to be the same as the reference', function() {
5858
modelValue.compareTo = 'different';
5959
$scope.$digest();
6060
expect(modelCtrl.$valid).toBeFalsy();

1820EN_09_Code/04_validate-equals_directive/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html ng-app="directives">
2+
<html ng-app="directives.validate-equals">
33
<head>
44
<meta charset="utf-8">
55
<title>AngularJS Book - Chapter 9 - validateEquals Directive</title>

0 commit comments

Comments
 (0)