Download full ebook of Angularjs Brad Green Shyam Seshadri instant download pdf
Download full ebook of Angularjs Brad Green Shyam Seshadri instant download pdf
Download full ebook of Angularjs Brad Green Shyam Seshadri instant download pdf
Download full ebook of Angularjs Brad Green Shyam Seshadri instant download pdf
1. Angularjs Brad Green Shyam Seshadri download
https://ebookbell.com/product/angularjs-brad-green-shyam-
seshadri-4144268
Explore and download more ebooks at ebookbell.com
2. Here are some recommended products that we believe you will be
interested in. You can click the link to download.
Angularjs Web Application Development Blueprints Vinci Rufus
https://ebookbell.com/product/angularjs-web-application-development-
blueprints-vinci-rufus-55893708
Angularjs Maintaining Web Applications Rodrigo Branas Chandermani
https://ebookbell.com/product/angularjs-maintaining-web-applications-
rodrigo-branas-chandermani-23272318
Angularjs Succinctly Frederik Dietz
https://ebookbell.com/product/angularjs-succinctly-frederik-
dietz-36134704
Angularjs Up And Running Enhanced Productivity With Structured Web
Apps 1st Edition Shyam Seshadri
https://ebookbell.com/product/angularjs-up-and-running-enhanced-
productivity-with-structured-web-apps-1st-edition-shyam-
seshadri-4912732
3. Angularjs Essentials Rodrigo Branas
https://ebookbell.com/product/angularjs-essentials-rodrigo-
branas-4939658
Angularjs Novice To Ninja 1st Edition Sandeep Panda
https://ebookbell.com/product/angularjs-novice-to-ninja-1st-edition-
sandeep-panda-4944544
Angularjs Web Application Development Cookbook Matt Frisbie
https://ebookbell.com/product/angularjs-web-application-development-
cookbook-matt-frisbie-4985094
Angularjs Testdriven Development Tim Chaplin
https://ebookbell.com/product/angularjs-testdriven-development-tim-
chaplin-4985212
Angularjs Web Application Development Cookbook Matt Frisbie
https://ebookbell.com/product/angularjs-web-application-development-
cookbook-matt-frisbie-4985540
9. Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
1. Introduction to AngularJS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Concepts 1
Client-Side Templates 2
Model View Controller (MVC) 3
Data Binding 3
Dependency Injection 5
Directives 5
An Example: Shopping Cart 6
Up Next 9
2. Anatomy of an AngularJS Application. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Invoking Angular 11
Loading the Script 11
Declaring Angular’s Boundaries with ng-app 12
Model View Controller 12
Templates and Data Binding 14
Displaying Text 15
Form Inputs 16
A Few Words on Unobtrusive JavaScript 19
Lists, Tables, and Other Repeated Elements 21
Hiding and Showing 23
CSS Classes and Styles 24
Considerations for src and href Attributes 26
Expressions 26
Separating UI Responsibilities with Controllers 27
Publishing Model Data with Scopes 28
Observing Model Changes with $watch 29
iii
www.it-ebooks.info
10. Performance Considerations in watch() 31
Organizing Dependencies with Modules 33
How Many Modules Do I Need? 36
Formatting Data with Filters 37
Changing Views with Routes and $location 38
index.html 39
list.html 39
detail.html 40
controllers.js 40
Talking to Servers 41
Changing the DOM with Directives 43
index.html 44
controllers.js 44
Validating User Input 45
Moving On 46
3. Developing in AngularJS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Project Organization 47
Tools 50
IDEs 50
Running Your Application 51
With Yeoman 51
Without Yeoman 51
Testing with AngularJS 52
Karma 52
Unit Tests 54
End-to-End/Integration Tests 55
Compilation 57
Other Awesome Tools 59
Debugging 59
Batarang 60
Yeoman: Optimizing Your Workflow 64
Installing Yeoman 65
Starting a Fresh AngularJS project 65
Running Your Server 65
Adding New Routes, Views, and Controllers 65
The Testing Story 66
Building Your Project 66
Integrating AngularJS with RequireJS 67
4. Analyzing an AngularJS App. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
The Application 77
iv | Table of Contents
www.it-ebooks.info
11. Relationship Between Model, Controller, and Template 78
The Model 79
Controllers, Directives, and Services, Oh My! 80
Services 80
Directives 84
Controllers 85
The Templates 89
The Tests 95
Unit Tests 96
Scenario Tests 99
5. Communicating with Servers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Communicating Over $http 101
Configuring Your Request Further 103
Setting HTTP Headers 104
Caching Responses 105
Transformations on Requests and Responses 106
Unit Testing 107
Working with RESTful Resources 108
The Declaration 111
Custom Methods 111
No Callbacks! (Unless You Really Want Them) 112
Simplified Server-Side Operations 112
Unit Test the ngResource 112
The $q and the Promise 113
Response Interception 115
Security Considerations 115
JSON Vulnerability 116
XSRF 116
6. Directives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Directives and HTML Validation 119
API Overview 120
Naming Your Directive 121
The Directive Definition Object 122
Transclusion 126
Compile and Link Functions 126
Scopes 128
Manipulating DOM Elements 132
Controllers 133
Table of Contents | v
www.it-ebooks.info
12. Moving On 136
7. Other Concerns. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
$location 137
HTML5 Mode and Hashbang Mode 140
AngularJS Module Methods 142
Where’s the Main Method? 142
Loading and Dependencies 143
Convenience Methods 144
Communicating Between Scopes with $on, $emit, and $broadcast 146
Cookies 148
Internationalization and Localization 148
What Can I Do in AngularJS? 149
How Do I Get It All Working? 149
Common Gotchas 150
Sanitizing HTML & the Sanitize Module 150
Linky 152
8. Cheatsheet and Recipes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Wrapping a jQuery Datepicker 153
ng-model 155
Binding select 155
Calling select 155
The Rest of the Example 156
The Teams List App: Filtering and Controller Communication 157
The Search Box 161
The Combo Boxes 161
The Check Box 161
The Repeater 161
File Upload in AngularJS 162
Using Socket.IO 164
A Simple Pagination Service 167
Working with Servers and Login 171
Conclusion 174
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
vi | Table of Contents
www.it-ebooks.info
13. Preface
I can trace Angular’s beginnings to 2009, on a project called Google Feedback. We’d
gone through months of frustration with our development speed and ability to write
testable code. At around the six month mark, we had around 17,000 lines of front-end
code. At that point, one of the team members, Misko Hevery, made a bold statement
that he’d be able to rewrite the whole thing in two weeks using an open source library
that he’d created as a hobby.
Ifiguredthatatwoweekdelaycouldn’thurtusthatmuchandwe’datleastbeentertained
by Misko scrambling to build something. Misko missed his time estimate. It took three
weeks. We were all astounded, but even more astounding was that the line count for
this new app had dropped from 17,000 to a mere 1,500. It seemed that Misko was onto
something worth pursuing.
Misko and I decided we’d built a team around the concepts he started with a simple
charter: to simplify the web developer’s experience. Shyam Seshadri, this book’s co-
author, went on to lead the Google Feedback team in developing Angular’s first shipping
application.
Since then, we’ve developed Angular with guidance both from teams at Google and
from hundreds of open source contributors around the world. Thousands of developers
rely on Angular in their daily work and contribute to an amazing support network.
We’re excited to learn what you’ll teach us.
Conventions Used in This Book
The following typographical conventions are used in this book:
Italic
Indicates new terms, URLs, email addresses, filenames, and file extensions.
vii
www.it-ebooks.info
14. Constant width
Used for program listings, as well as within paragraphs to refer to program elements
such as variable or function names, databases, data types, environment variables,
statements, and keywords.
Constant width bold
Shows commands or other text that should be typed literally by the user.
Constant width italic
Shows text that should be replaced with user-supplied values or by values deter‐
mined by context.
This icon signifies a tip, suggestion, or general note.
This icon indicates a warning or caution.
Using Code Examples
This book is here to help you get your job done. In general, if this book includes code
examples, you may use the code in this book in your programs and documentation. You
do not need to contact us for permission unless you’re reproducing a significant portion
of the code. For example, writing a program that uses several chunks of code from this
book does not require permission. Selling or distributing a CD-ROM of examples from
O’Reilly books does require permission. Answering a question by citing this book and
quoting example code does not require permission. Incorporating a significant amount
of example code from this book into your product’s documentation does require per‐
mission.
We appreciate, but do not require, attribution. An attribution usually includes the title,
author, publisher, and ISBN. For example: “AngularJS by Brad Green and Shyam Se‐
shadri(O’Reilly).Copyright2013BradGreenandShyamSeshadri,978-1-449-34485-6.”
If you feel your use of code examples falls outside fair use or the permission given above,
feel free to contact us at [email protected].
viii | Preface
www.it-ebooks.info
15. Safari® Books Online
Safari Books Online is an on-demand digital library that delivers ex‐
pert content in both book and video form from the world’s leading
authors in technology and business.
Technology professionals, software developers, web designers, and business and crea‐
tive professionals use Safari Books Online as their primary resource for research, prob‐
lem solving, learning, and certification training.
Safari Books Online offers a range of product mixes and pricing programs for organi‐
zations, government agencies, and individuals. Subscribers have access to thousands of
books, training videos, and prepublication manuscripts in one fully searchable database
from publishers like O’Reilly Media, Prentice Hall Professional, Addison-Wesley Pro‐
fessional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John
Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT
Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technol‐
ogy, and dozens more. For more information about Safari Books Online, please visit us
online.
How to Contact Us
Please address comments and questions concerning this book to the publisher:
O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707-829-0104 (fax)
We have a web page for this book, where we list errata, examples, and any additional
information. You can access this page at http://oreil.ly/angularJS.
To comment or ask technical questions about this book, send email to bookques
[email protected].
For more information about our books, courses, conferences, and news, see our website
at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia
Preface | ix
www.it-ebooks.info
16. Acknowledgments
We’d like to give special thanks to Misko Hevery, father of Angular, for having the
courage to think very differently about how we write web applications and to drive it
into reality; to Igor Minar for bringing stability and structure to the Angular project
and for building the roots of today’s awesome open source community; to Vojta Jina for
creating many parts of Angular, and for giving us the fastest test runner the world has
ever seen; to Naomi Black, John Lindquist, and Mathias Matias Niemelä for their expert
editing assistance. And finally, thank you to the Angular community for their contri‐
butions, and for teaching us about making Angular great through feedback from build‐
ing real applications.
x | Preface
www.it-ebooks.info
17. CHAPTER 1
Introduction to AngularJS
Our ability to create amazing web-based apps is incredible, but the complexity involved
in making these apps is similarly incredible. We on the Angular team wanted to relieve
the pain involved with developing AJAX applications. At Google, we’d worked through
the hard lessons of building large web applications like Gmail, Maps, Calendar, and
severalothers.Wethoughtwemightbeabletousetheseexperiencestobenefiteveryone.
We wanted writing web apps to feel more like the first time we wrote a few lines of code
and stood back in amazement at what we’d made happen. We wanted the coding process
to feel more like creating and less like trying to satisfy the strange inner workings of
web browsers.
At the same time, we wanted an environment that helped us make the design choices
that make apps easy to create and understand from the start, but that continue to be the
right choices to make our apps easy to test, extend, and maintain as they grow large.
We’ve tried to do this in the Angular framework. We’re very excited about the results
we’ve achieved. A lot of credit goes to the open source community around Angular who
do a fantastic job supporting each other and who have taught us many things. We hope
you’ll join our community and help us learn how Angular can be even better.
Some of the larger and more involved examples and code snippets are available on a
GitHub repository for you to look at, fork, and play with at our GitHub page.
Concepts
There are a few core ideas that you’ll use throughout an Angular app. As it turns out,
we didn’t invent any of these. Instead, we’ve borrowed heavily from successful idioms
in other development environments and implemented them in a way that embraces
HTML, browsers, and many other familiar web standards.
1
www.it-ebooks.info
18. Client-Side Templates
Multi-page web applications create their HTML by assembling and joining it with data
on the server, and then shipping the finished pages up to the browser. Most single-page
applications—also known as AJAX apps—do this as well, to some extent. Angular is
different in that the template and data get shipped to the browser to be assembled there.
The role of the server then becomes only to serve as static resources for the templates
and to properly serve the data required by those templates.
Let’s see an example of what assembling this data and template on the browser looks
like in Angular. We’ll take the obligatory Hello, World example, but instead of writing
“Hello, World” as a single string, let’s structure the greeting “Hello” as data that we could
change later.
For it, we’ll create our template in hello.html:
<html ng-app>
<head>
<script src="angular.js"></script>
<script src="controllers.js"></script>
</head>
<body>
<div ng-controller='HelloController'>
<p>{{greeting.text}}, World</p>
</div>
</body>
</html>
And our logic in controllers.js:
function HelloController($scope) {
$scope.greeting = { text: 'Hello' };
}
Loading hello.html into any browser will then produce what we see in Figure 1-1:
Figure 1-1. Hello, World
There are a few interesting things to note here in comparison with most methods in
widespread use today:
• There are no classes or IDs in the HTML to identify where to attach event listeners.
• When HelloController set the greeting.text to Hello, we didn’t have to register
any event listeners or write any callbacks.
2 | Chapter 1: Introduction to AngularJS
www.it-ebooks.info
19. • HelloController is a plain JavaScript class, and doesn’t inherit from anything that
Angular provides.
• HelloController got the $scope object that it needed without having to create it.
• We didn’t have to call the HelloController’s constructor ourselves, or figure out
when to call it.
We’ll look at more differences soon, but it should be clear already that Angular appli‐
cations are structured very differently than similar applications were in the past.
Why have we made these design choices and how does Angular work? Let’s look at some
good ideas Angular stole from elsewhere.
Model View Controller (MVC)
MVC application structure was introduced in the 1970s as part of Smalltalk. From its
start in Smalltalk, MVC became popular in nearly every desktop development envi‐
ronment where user interfaces were involved. Whether you were using C++, Java, or
Objective-C, there was some flavor of MVC available. Until recently, however, MVC
was all but foreign to web development.
The core idea behind MVC is that you have clear separation in your code between
managing its data (model), the application logic (controller), and presenting the data
to the user (view).
The view gets data from the model to display to the user. When a user interacts with the
application by clicking or typing, the controller responds by changing data in the model.
Finally, the model notifies the view that a change has occurred so that it can update what
it displays.
InAngularapplications,theviewistheDocumentObjectModel(DOM),thecontrollers
are JavaScript classes, and the model data is stored in object properties.
We think MVC is neat for several reasons. First, it gives you a mental model for where
to put what, so you don’t have to invent it every time. Other folks collaborating on your
project will have an instant leg up on understanding what you’ve written, as they’ll know
you’re using MVC structure to organize your code. Perhaps most importantly, we’ll
claim that it delivers great benefits in making your app easier to extend, maintain, and
test.
Data Binding
Before AJAX single-page apps were common, platforms like Rails, PHP, or JSP helped
us create the user interface (UI) by merging strings of HTML with data before sending
it to the users to display it.
Concepts | 3
www.it-ebooks.info
20. Libraries like jQuery extended this model to the client and let us follow a similar style,
but with the ability to update, part of the DOM separately, rather than updating the
whole page. Here, we merge template HTML strings with data, then insert the result
where we want it in the DOM by setting innerHtml on a placeholder element.
Thisallworksprettywell,butwhenyouwanttoinsertfresherdataintotheUI,orchange
the data based on user input, you need to do quite a bit of non-trivial work to make sure
you get the data into the correct state, both in the UI and in JavaScript properties.
But what if we could have all this work done for us without writing code? What if we
could just declare which parts of the UI map to which JavaScript properties and have
them sync automatically? This style of programming is called data binding. We included
it in Angular because it works great with MVC to eliminate code when writing your
view and model. Most of the work in moving data from one to the other just happens
automatically.
To see this in action, let’s take the first example and make it dynamic. As is, the Hello
Controller sets the model greeting.text once and it never changes from then on. To
make it live, let’s change the example by adding a text input that can change the value
of greeting.text as the user types.
Here’s the new template:
<html ng-app>
<head>
<script src="angular.js"></script>
<script src="controllers.js"></script>
</head>
<body>
<div ng-controller='HelloController'>
<input ng-model='greeting.text'>
<p>{{greeting.text}}, World</p>
</div>
</body>
</html>
The controller, HelloController, can stay exactly the same.
Loading it in a browser, we’d see the screen captured in Figure 1-2.
Figure 1-2. The default state of the greeting app
If we replace Hello with Hi in the input field, we’d see the screen captured in Figure 1-3.
4 | Chapter 1: Introduction to AngularJS
www.it-ebooks.info
21. Figure 1-3. The Greeting App with input changed
Without ever registering a change listener on the input field, we have a UI that will
dynamically update. The same would be true for changes coming to and from the server.
In our controller, we could make a request to our server, get the response, and set
$scope.greeting.text to equal what it returns. Angular would automatically update
both the input and the text in the curly braces to that value.
Dependency Injection
We mentioned it before, but it bears repeating that there’s a lot going on with Hello
Controller that we didn’t have to write. For example, the $scope object that does our
data binding is passed to us automatically; we didn’t have to create it by calling any
function. We just asked for it by putting it in HelloController’s constructor.
As we’ll find out in later chapters, $scope isn’t the only thing we can ask for. If we want
to data bind to the location URL in the user’s browser, we can ask for an object that
manages this by putting $location in our constructor, like so:
function HelloController($scope, $location) {
$scope.greeting = { text: 'Hello' };
// use $location for something good here...
}
We get this magical effect through Angular’s dependency injection system. Dependency
injection lets us follow a development style in which, instead of creating dependencies,
our classes just ask for what they need.
This follows a design pattern called the Law of Demeter, also known as the principle of
least knowledge. Since our HelloController’s job is to set up the initial state for the
greeting model, this pattern would say that it shouldn’t worry about anything else, like
how $scope gets created, or where to find it.
This feature isn’t just for objects created by the Angular framework. You can write the
rest of this code as well.
Directives
One of the best parts of Angular is that you can write your templates as HTML. You can
do this because at the core of the framework we’ve included a powerful DOM trans‐
formation engine that lets you extend HTML’s syntax.
Concepts | 5
www.it-ebooks.info
22. We’ve already seen several new attributes in our templates that aren’t part of the HTML
specification. Examples include the double-curly notation for data binding, ng-
controller for specifying which controller oversees which part of the view, and ng-
model, which binds an input to part of the model. We call these HTML extension
directives.
Angular comes with many directives that help you define the view for your app. We’ll
see more of them soon. These directives can define what we commonly view as the
template. They can declaratively set up how your application works or be used to create
reusable components.
And you’re not limited to the directives that Angular comes with. You can write your
own to extend HTML’s template abilities to do anything you can dream of.
An Example: Shopping Cart
Let’s look at a slightly larger example that shows off a bit more of Angular. Let’s imagine
that we’re going to build a shopping app. Somewhere in the app we’ll need to show the
user’s shopping cart and let him edit it. Let’s skip straight to that part.
<html ng-app='myApp'>
<head>
<title>Your Shopping Cart</title>
</head>
<body ng-controller='CartController'>
<h1>Your Order</h1>
<div ng-repeat='item in items'>
<span>{{item.title}}</span>
<input ng-model='item.quantity'>
<span>{{item.price | currency}}</span>
<span>{{item.price * item.quantity | currency}}</span>
<button ng-click="remove($index)">Remove</button>
</div>
<script src="angular.js"></script>
<script>
function CartController($scope) {
$scope.items = [
{title: 'Paint pots', quantity: 8, price: 3.95},
{title: 'Polka dots', quantity: 17, price: 12.95},
{title: 'Pebbles', quantity: 5, price: 6.95}
];
$scope.remove = function(index) {
$scope.items.splice(index, 1);
}
}
</script>
</body>
</html>
6 | Chapter 1: Introduction to AngularJS
www.it-ebooks.info
23. The resulting UI looks like the screenshot in Figure 1-4.
Figure 1-4. The Shopping Cart UI
The following is a brief tour of what’s going on here. The rest of the book is dedicated
to a more in-depth explanation.
Let’s start at the top:
<html ng-app>
The ng-app attribute tells Angular which parts of the page it should manage. Since we’ve
placed it on the <html> element, we’re telling Angular that we want it to manage the
whole page. This will often be what you want, but you might want to place it on a <div>
withintheappifyou’reintegratingAngularwithanexistingappthatusesothermethods
to manage the page.
<body ng-controller='CartController'>
In Angular, you manage areas of the page with JavaScript classes called controllers. By
including a controller in the body tag, I’m declaring that CartController will manage
everything between <body> and </body>.
<div ng-repeat='item in items'>
The ng-repeat says to copy the DOM inside this <div> once for every element in an
array called items. On every copy of the div, it will also set a property named item to the
current element so we can use it in the template. As you can see, this results in three
<div>s each, containing the product title, quantity, unit price, total price, and a button
to remove the item entirely.
<span>{{item.title}}</span>
As we showed in the “Hello, World” example, data binding via {{ }} lets us insert the
value of a variable into part of the page and keep it in sync. The full expression
{{item.title}} retrieves the current item in the iteration and then inserts the contents
of that item’s title property into the DOM.
<input ng-model='item.quantity'>
The ng-model definition creates data binding between the input field and the value of
item.quantity.
An Example: Shopping Cart | 7
www.it-ebooks.info
24. The {{ }} in the <span> sets up a one-way relationship that says “insert a value here.”
We want that effect, but the application also needs to know when the user changes the
quantity so it can change the total price.
We’llkeepchangesinsyncwithourmodelbyusingng-model.Theng-modeldeclaration
inserts the value of item.quantity into the text field, but it also automatically updates
item.quantity whenever the user types a new value.
<span>{{item.price | currency}}</span>
<span>{{item.price * item.quantity | currency}}</span>
We want the unit price and total price to be formatted as dollars. Angular comes with
a feature called filters that lets us transform text, and there’s a bundled filter called
currency that will do this dollar formatting for us. We’ll look at filters more in the next
chapter.
<button ng-click='remove($index)'>Remove</button>
This allows users to remove items from their carts by clicking a Remove button next to
the product. We’ve set it up so that clicking this button calls a remove() function. We’ve
also passed in $index, which contains the iteration number of the ng-repeat, so we
know which item to remove.
function CartController($scope) {
This CartController manages the logic of the shopping cart. We’ll tell Angular that
the controller needs something called $scope by putting it here. The $scope is what lets
us bind data to elements in the UI.
$scope.items = [
{title: 'Paint pots', quantity: 8, price: 3.95},
{title: 'Polka dots', quantity: 17, price: 12.95},
{title: 'Pebbles', quantity: 5, price: 6.95}
];
By defining $scope.items, I’ve created a dummy data hash to represent the collection
of items in the user’s shopping cart. We want to make them available to data bind with
the UI, so we’ll add them to $scope.
Of course, a real version of this can’t just work in memory, and will need to talk to a
server to properly persist the data. We’ll get to that in later chapters.
$scope.remove = function(index) {
$scope.items.splice(index, 1);
}
Wewanttheremove() functionavailabletobindintheUI,sowe’veaddedthisto$scope
as well. For the in-memory version of the shopping cart, the remove() function can just
delete items from the array. Because the list of <div>s created by ng-repeat is data
8 | Chapter 1: Introduction to AngularJS
www.it-ebooks.info
26. It had not been by any means the most popular rendezvous of the
miners, but on this day it received a huge advertisement, and
profited accordingly.
We walked to the end of the street, where the bustle was
considerably less, and here we noticed a large wooden erection
bearing the sign, "Tom Doyle, Kanowna Hotel."
"That is the name Bill mentioned," said Phil; "he seems a fairly
important individual in his own way. Suppose we interview him, or at
least have dinner in his mansion."
To the latter part of the suggestion I was agreeable, and so in we
went. I had met Tom Doyle on several occasions since my arrival in
the country; that gentleman was most ubiquitous in his habits, and
had a keen scent for gold, so that his lanky figure might be expected
anywhere where good prospects had recently been obtained. He was
also future mayor of the camp, and so was, as Phil had put it, quite
an important individual in his way; but how we could benefit by
giving him Emu Bill's name and compliments was more than I could
understand.
The hotel seemed to be completely empty; even the bar was
deserted, which showed an extraordinary state of matters. "If Mac
and Stewart were here," laughed Phil, "there would be a repetition
of the Indian village raid I have heard so much about." Which I fear
was only too true. However, we determined to give fair warning of
our presence in the establishment, and halloed out lustily; and at
last a heavy footstep sounded in the room above.
"Doyle!" I cried, "Sir Thomas Doyle!"
"Lord Doyle!" added Phil, in a voice that might have awakened the
seven sleepers.
"Phwat the thunder'n' blazes is yez yellin' at!" roared the object of
our inquiry, suddenly appearing on the stairway. Then he noticed the
vacant bar. "Thunder'n' turf!" he muttered helplessly, "has all the
shop cleared out after that d—— d nugget?"
27. "Looks like it, Tom," I suggested. "Have you been asleep?"
"Av coorse. It's me afternoon siesta I was having. I'll be in time for
the rush all right, an' don't you forget it."
"We didn't come to warn you about that," I said. "Emu Bill of the
Five Mile said you had a few good horses——"
Ready for the Rush.
"Emoo Bill!" he howled.
"Same man," I admitted; "do you know him?"
28. "Does I know Emoo Bill? Well, I should smile. Why, me an' him were
with Hannan when that old skunk went back on us at the discovery
ov Kalgoorlie. Howly Moses! Poor owld Emoo! Horses, boys? Surely.
I'm goin' to use 'Prince' myself, but yez can have the two
steeplechasers, 'Satan' an' 'Reprieve.' I'll do that much for the Emoo;
an' d—— n the others who expect the horses."
Events had certainly developed much more rapidly than I had
anticipated; neither Phil nor myself had entertained the idea of
joining in the rush. I had mentioned Emu Bill's message idly, never
dreaming it would produce such a prompt effect. Tom Doyle was a
noted sporting man in the district, a second Harry Lorrequer in a
small way, and provided he was not drunk, he could break in even
the most unruly horse when all others had failed.
The noise on the street was now becoming terrific; small armies of
miners bearing picks and stakes were arriving from the local
diggings, and buggies and horses were being hurriedly equipped.
"We'll have a dhrop av the crater first," said Tom, noting the
disturbance outside, "and then we'll saddle up."
Shortly afterwards we emerged from the hotel courtyard mounted
on horses that were the pride of the countryside. Tom rode "Prince,"
a powerful-limbed, coal-black cob of sixteen hands; Phil bestrode
"Satan," a fiery Australian brumby; and I clung to "Reprieve," an
impetuous high-stepping bay. "Keep at my heels, boys," cried Tom,
as he started off at a canter, and it was at once evident that if we
could keep at his heels we should be in at the death without a
doubt. It was slightly after three o'clock, and when we reached the
scene of excitement we found the street absolutely blocked. There
must have been several thousand men packed like sardines right
across the broad passage, and on the outskirts of this vast crowd
over a hundred cyclists stood ready; beyond them still, a line of
horsemen were drawn up, in numbers exceeding a regimental
squadron.
29. Scores of buggies and other spidery racing contrivances were
scattered near at hand, and extended far down the side street
leading towards the post-office. It was indeed an extraordinary sight.
We formed up with the other horsemen, Tom's approach being
hailed with loud cheers, for every one knew the dare-devil Irishman.
"You'll get a broken neck this time, Tom," cried one of his
acquaintances cheerfully.
"I didn't know Prince was broken in to the saddle yet, Tom," said
another.
"No more he isn't," replied Tom, "but he's broken enough for me.
Stand clear, bhoys."
And then the black charger reared and bucked and curvetted wildly,
while its rider kicked his feet out of the stirrups and kept his seat like
a Centaur. Few of the horses present had been much used before,
and they now became restive also, and pranced dangerously. Phil
and I had a bad five minutes. We did not know the nature or temper
of our mounts; and besides, neither of us cared to place much
reliance on our stirrup leathers, they looked frayed and wofully
fragile.
"If they go with yez, bhoys," advised Tom, "give 'em their heads.
They'll get tired soon enough. Thar's lots o' room in this country."
"Oh, Lord!" groaned Phil, "what a comfortable prospect we have
before us! My back is about broken with this kicking brute already."
The vast assembly was now becoming impatient. The stated time,
3.30, had been reached, and as yet there was no sign of the
Reverend Father who had been the cause of the extraordinary
meeting. Then just as threats and curses were being muttered, a
pale-faced young man in clerical garb made his appearance on the
balcony, and a deathlike stillness reigned in an instant. In a few
words the priest explained his strange position, but he was rudely
interrupted many times.
30. "It's gettin' late. Where did the nugget come from?" the rougher
spirits roared. The young man hesitated for a moment.
"The nugget was found on the Lake Gwinne track," he said, "at a
depth of three feet——"
With a long, indescribable roar the multitude scattered, and the
speaker's concluding words were drowned in the din. "Hold on!"
cried Tom, as Phil and I swung round to follow the main rush, "the d
—— d idiots didn't wait to hear how far it was from Lake Gwinne."
There was scarcely a dozen of us left; the breaking-up had been as
the melting of summer snows.
"And the position is two miles from the lake," repeated the young
man, wearily. Then Tom gave his horse a free rein and we followed
suit.
Lake Gwinne was a salt-crusted depression in the sand surface,
about five miles distant from the township, and in a very little
frequented vicinity. The so-called track towards it was nothing more
than a winding camel pad through the bush, and had the miners
stopped to think, they would have at once realised how insufficient
was the data given. With our additional information we were slightly
better off; nevertheless I was not at all inclined to grow enthusiastic
over our chances. The district mentioned had been very thoroughly
prospected many months before, and with little success. "I think
Father Long has been hoaxed after all," I said to Phil, as we crashed
through scrub and over ironstone gullies in the wake of the main
body, which we were rapidly overtaking. But he could not reply; his
horse was clearing the brush in great bounds, and as it had the bit
between its teeth, my companion evidently had his work cut out for
him.
A few yards ahead Tom's great charger kept up a swinging gallop,
and every now and then that jolly roysterer would turn in the saddle
and encourage us by cheery shouts. We soon passed the men who
were hurrying on foot, but the buggies and the cycles were still in
front. The sand soil throughout was so tightly packed that it formed
31. an ideal cycle path, but the sparse eucalypti dotting its surface were
dangerous obstacles, and made careful steering a necessity. The
goldfield cyclist, however, is a reckless individual, and rarely counts
the cost of his adventurousness. Soon we came near to the cyclist
army; the spokes of their wheels scintillated in the sunlight as they
scudded over the open patches. But one by one they dropped out,
the twisted wheels showing how they had tried conclusions with
flinty boulders, or collided with one or other of the numberless
mallee stumps protruding above the ground.
On one occasion Tom gave a warning shout, and I saw his horse
take a flying leap over a struggling cyclist who had got mixed up in
the parts of his machine. I had just time to swerve my steed to
avoid a calamity, and then we crashed on again at a mad gallop,
evading the bicycles as best we could, and sometimes clearing those
which had come to grief at a bound. It was in truth a wild and
desperate race.
When the last of the cyclists had been left behind, and the swaying,
dust-enshrouded buggies and one or two solitary horsemen were
still in front, Tom turned again.
"Let her go now, bhoys," he said, "there's a clear field ahead. Whoop
la! Tally ho!"
For the remainder of that gallop I had little time to view my
surroundings; I dug my heels into "Reprieve's" flanks, and he
stretched out his long neck and shot forward like an arrow from the
bow. Buggies and miscellaneous vehicles were overtaken and left in
the rear. Various horsemen would sometimes range alongside for a
trial of speed, but "Reprieve" outdistanced them all.
"It's Doyle's 'Reprieve,'" one of the disgusted riders cried; "an'
there's 'Satan,' an', fire an' brimstone! here's Doyle hissel'."
Tom's weight was beginning to tell on his noble animal, which had
given the lead to my horse who carried the lightest load; but with
scarcely a dozen lengths between us we thundered past the
foremost racing buggy, and were quickly dashing down towards Lake
32. Gwinne, whose sands now shimmered in the near distance. We were
first in the rush after all.
Suddenly we came upon a recently-excavated shaft with a
dismantled windlass lying near, and with one accord we drew up and
dismounted.
"If this is where the Sacred Nugget came out of, it looks d—— d bad
that no one is about," growled Tom, throwing the reins of his horse
over a mulga sapling and looking around doubtfully. It was clearly
the vicinity indicated by Father Long, and we lost no time in marking
off our lots in the direction we considered most promising. We had
barely taken these preliminary precautions when horsemen and
buggies began to arrive in mixed order, and in a short time the
ground all the way down to the lake was swarming with excited
gold-seekers.
"I'm blest if I like the look o' things at all, at all," mused Tom, and I
was inclined to take a similar view of matters, for a more barren-
looking stretch of country would have been hard to find. Then,
again, by examining the strata exposed in the abandoned shaft we
could form a fair estimate of the nature of the supposed gold-
bearing formation; and after Phil and I had made a minute survey of
all indications shown, we came to the conclusion that our ground,
acquired after such a hard ride, was practically worthless and not
likely to repay even the labour of sinking in it.
The hundreds of others who had pegged out beyond us were not so
quickly convinced, and they announced their intention of sinking to
bedrock if they "busted" in the attempt. About an hour after our
arrival at the Sacred Nugget Patch, Phil and I started back for the
Five-Mile Flat, satisfied to have taken part in so strange a rush, yet
quite certain that the Sacred Nugget had been unearthed in some
other district, or that the entire concern had been a stupendous
hoax. Tom Doyle decided to camp on the so-called "Patch" all night,
without any special reason for doing so beyond holding the ground
in case some fool might want to buy it for flotation purposes, as had
been done often before with useless properties.
33. When we reached home that evening we were tired indeed, and in
spite of ourselves we felt rather disappointed at the unsuccessful
issue of the much-advertised stampede.
"Ye've had a gran' time," said Mac regretfully, when Phil told of how
he and "Satan" came in first after a most desperate race.
"I'm glad I didn't go with you," said Bill. "I hope I can resist
temptation in the way o' rushes until I is ready to sail back
homeward."
"It would certainly be better," I allowed, "than to give up a proved
property for a miserable sham."
As it happened, the famous rush had indeed proved but a worthless
demonstration. Not a grain of gold was discovered near the Sacred
Patch; and after much labour had been expended there, the
disgusted miners abandoned their shafts in a body.
34. A Breakdown in the Rush.
The mystery connected with the alleged nugget was never
explained. Every bank in the Colony denied having seen it, and its
supposed finders did not again appear on the fields. Father Long
must have been cruelly victimised, of that there was no doubt, for
no one could for a moment believe that he had perjured himself. He
was justly known as a thoroughly honourable man and a
conscientious teacher. Even the most suspicious mind could not
accuse him in any way. And he, the unfortunate dupe of a pair of
unscrupulous rogues, did not long survive the severe shock given to
an already feeble system. He died some months later, and with him
went the secret, if any, of the Great Sacred Nugget.
35. INTO THE "NEVER NEVER" LAND
A few weeks after the Sacred Nugget rush had taken place we
lowered our flag at the Five-Mile Flat, having come to an end of the
auriferous workings within our boundaries. I had meanwhile
succeeded in purchasing from an Afghan trader two powerful camels
and five horses, with the intention of using them on our projected
inland expedition. The horses, I feared, would prove of little service,
but for the early part of the journey they might relieve the camels
somewhat by carrying the various tinned foodstuffs necessary for a
long sojourn in the desert. These "various" stores vary but little
notwithstanding their distinguishing labels, and the bushman's
vocabulary, always expressive, contains for them a general title,
namely, "tinned dog."
Tinned dog and flour are, indeed, the sum total of the Australian
explorer's needs. The traveller in the great "Never Never" land is not
an epicure by any means, and should he be burdened by over-
æsthetic tastes they quickly vanish when "snake sausage" or "bardie
pie" has appeared on his menu for some days!
Phil had decided to accompany us, and as he had shared our
fortunes since our entry into the country, I was by no means loath to
accept of his services, knowing him to be a highly trustworthy
comrade, and an invaluable addition to our little party he proved.
It was hard to say goodbye to our old associates of the camp fire; I
knew they would not remain much longer at the same diggings,
which were showing signs of playing out in almost every claim, and
it was not likely we should ever meet again.
Old Tom was much affected; he had been our near neighbour so
long, and under the happiest circumstances of his wandering life, so
he said, and now we were going back into the "Never Never"
36. country, and would never see him more. I was not quite certain
whether Old Tom meant that we should most probably leave our
bones in the central deserts, or whether his words were due to an
extreme sentimentalism on his part, but I preferred to believe the
latter.
"We'll call and see you at Adelaide some of these times, Tom," I
said, while Stewart and Mac were bidding him an affectionate
farewell, but he only shook his head mournfully, and would not be
comforted.
As for Emu Bill, he had considerable faith in our enterprise, and
would, I believe, have come with us had I said the word. He was,
however, a true specimen of the independent bushman, and
unwilling to demonstrate his wishes.
"Durn it all, boys," said he with vigour, "I is not an old man yet, an'
tho' I knows you aire a big enuff party without me to get through
the mallee country, I guess I'll coast it round to Derby in time to jine
you in a Leopolds trip."
"I thought you were going home after this rise, Bill," I said
quizzically, not surprised to find his early resolutions wavering.
"I'll mebbe see you 'cross the Leopolds first," he replied gravely. "I
calc'late I knows that bit o' kintry better'n any white man."
"Goodbye, boys," roared Nuggety Dick and his satellites, waving
their shovels from their distant claims, and the echoes were taken
up from end to end of the lead, for where I was wholly unknown
Mac and Stewart had endeared themselves by devices peculiar to
that crafty pair. It was pleasant to receive such a genial send-off,
and though I am not as a rule affected by farewell greetings, yet on
this occasion I felt strangely moved. The camels and horses stood
ready, laden with the great water-bags and unwieldy mining
machinery, and Phil was stroking the mane of one of the horses in
listless fashion.
"It's a fairly long trip for you to start on, Phil," I said, noting the far-
away expression on his usually bright face.
37. "I was thinking of other things," he answered quietly.
"Gee up, Misery!" cried Mac, cracking his long whip.
"Gee up, Slavery!" echoed Stewart. And we started out, heading
N.N.E., bound for the land where the pelican builds its nest.
For the first few miles we crossed the gridiron-like tracks connecting
the numerous camps and settlements lying out from the main
township of Kalgoorlie; but soon these signs of civilisation vanished,
and in the early afternoon our course lay over a wildering scrubland,
with iron-shot sand-patches here and there among the stunted
shrubs. The camels, which we had named "Slavery" and "Misery,"
led the trail. They were, indeed, wiry animals, and as I paced beside
them, noting their almost ludicrously leisurely tread, I could not help
remarking on the vast amount of latent power indicated in every
movement of their rubber-like bodies. "Slavery" was a patient and
gentle animal, and marched along meekly under his load of full
seven hundred pounds, but "Misery" soon displayed a somewhat
fiery temper, and before our first day's journey was completed we
were compelled to adopt stern measures with the recalcitrant brute.
The horses formed a sad-looking line behind the sturdier beasts of
burden, and they would cheerfully have forced along at a speedier
rate than the progress of the camels allowed. Among them were two
high-spirited animals, which we named "Sir John" and "Reprieve,"
while the three others we dubbed simply "Sin," "Sand," and
"Sorrow."
We camped that evening just twelve miles from our starting-point,
and yet it seemed as if we were already beyond the reach of
civilisation. Not a trace of a white man's presence was visible
anywhere, and for the first night we missed the crashing rattle of the
ever-working batteries. A deathlike stillness filled the air, broken only
by the startled scream of the carrion crow or the weird double note
of the mopoke.
"There's any amount of room for prospecting here," hazarded Phil,
gazing around, after the horses and camels had been safely
38. picketed. Which was true; yet who could have the heart to sink a
proving shaft amid such inhospitable surroundings?
"If we locate an outcrop, boys," I said, "we may trace it up, but
otherwise we can only test the surface sands with the dryblower."
It was but vaguely known what kind of country lay far to eastward of
us. Many thousands of square miles had never been crossed by any
traveller, and strange rumours were often circulated among the
miners of the various outposts regarding the extraordinary riches of
the vast "Never Never" land. It was even predicted that a great
inland river flowed northwards towards the Gulf of Carpentaria; how
far it flowed before sinking in the arid sands was a matter for
conjecture, but it was confidently supposed to drain fertile valleys,
and to be flanked by noble mountain ranges rich in gold and
precious gems. It was a rosy enough picture, surely, but one which,
unfortunately, no explorer had yet succeeded in bearing out.
"It's a gran' thing," said Mac thoughtfully, when supper was over,
and we were reclining on our blankets gazing at the stars, and
listening to the tinkling of the camel bells. "It's a vera gran' thing,"
he repeated, "tae be alane aince mair, an' wi' the bonnie stars shinin'
brichtly abune——"
"Here's a centipede!" roared Stewart, interrupting his comrade's
moralising.
"Then pit it in yer pocket, ma man," was the calm reply; and he
resumed where he had left off: "Ay, it's a gran' thing, Phil, tae ken
that ye're traivellin' in new country, breathin' the bonnie pure air.
Noo if ye had been wi' me an' Stewart oot in Alaskie——"
"Spin me a yarn, Mac," said Phil, drawing his blanket closer, while
Stewart started up in sheer amazement.
Mac was visibly affected; he took his pipe from his mouth and gazed
at the camp fire blankly for some time without speaking. "Ye're a
guid an' thochtfu' man, Phil," he said at length with great
earnestness, "an' A'll gie ye a rale bonnie story...."
39. I will pass but briefly over the early days of our march. Our track at
first led through the Murchison district, for I wished to make a mid-
northerly latitude before steering east; but after leaving the
Gascoyne Channel the country traversed was of the most dreary
nature, and similar to that around the more desolate southern gold
camps. Several soaks were found opportunely when the water-bags
were becoming dangerously flat, and our progress continued
uneventfully for over a week, but then the formation of the land-
surface began to change rapidly for the worse. The dwarfed
eucalypti became sparser and sparser, and in their room appeared
bushy clumps of saltbush and tufts of spiky spinifex grass. The hard
ironsand soil, too, gave place to a white yielding gravel which
hindered our advance greatly. The camels, certainly, were not
seriously inconvenienced, but the staggering horses sank over the
fetlocks at each step, and stumbled forward painfully, while we
floundered alongside, almost blinded by the rising iron dust which
filled our ears and nostrils.
40. Our Last View of the Five-Mile Working.
For two days we crossed this disheartening waste, fearing greatly for
the safety of the horses, which showed signs of collapse. No water
had been located for three days before entering upon this miserable
tract, and assuredly none promised on its parched expanse. The
horses—poor animals!—fared rather ill in consequence, for we dared
not give them much of our rapidly-diminishing fluid supply. On the
morning of the third day, however, our course led across slightly-
improved country, so that better progress was made, and our
chances of finding water were decidedly more encouraging.
At noon we entered a belt of scrub, and soon were crashing through
a miniature forest of stunted mallee; but this state of affairs was not
41. destined to last, for we could see in the distance, at a slightly higher
altitude, the open plain extending back into the horizon. At this point
Phil considered the indications very favourable for water, and we
decided to make a temporary camp, and search the district
thoroughly before proceeding. We were preparing to unload the
camels, when Stewart, who had gone a little way ahead, came
rushing back in great excitement. "Niggers!" he hoarsely whispered.
Looking up I saw quite an assembly of stalwart bucks directly in our
course, and scarcely two hundred yards in front. Some bushes
partially hid them from our view, and they had evidently not yet
observed us. They were well equipped with spears and waddies;
probably they were out on a hunting expedition, and, if so, it boded
well for the resources of the district.
While we hesitated, debating on our best plan of action, they saw
us, and gave vent to a series of shrill yells, yet were apparently
undecided whether to resent our presence or escape while they
might. Then a shower of spears whizzed through the air, but fell
short, and buried their heads in the sand at our feet. We were just
out of range of these missiles, luckily enough. My companions were
not disposed to tolerate such tactics, and Mac discharged his gun,
loaded with small shot, at the hostile band. They waited no longer,
but made a wild rush into the densest part of the scrub, and were
quickly lost to sight. Then we proceeded onwards warily, whilst far in
the distance the branches crackled and broke before the fleeing
horde. The scene of their stand was littered with fragments of
brushwood, and the dying embers of a fire smouldered in the centre
of a small clearing close by. All around, shields, spears, and
boomerangs lay scattered as they had been thrown when their
owners took to flight. The sight was curiously strange and
impressive.
My usually loquacious companions had been wonderfully silent
during the last day or so, owing, perhaps, to the uninspiring nature
of our environment, but now Mac succeeded in launching into a
lengthy diatribe, in which he consigned the blacks generally to a
very warm climate indeed.
42. "At the same time," said he, "we shidna forget that such inceedents
serve a vera usefu' purpose."
"They seemed rale dacent black buddies," reflectively murmured
Stewart.
"And they entertained the laudable desire of puncturing us with 'rale
dacent' spears," Phil added shortly.
The camels stood patiently within the clearing, with their long necks
outstretched, and their heads moving up and down with the
regularity of automatons; the horses straggled behind, gasping
feebly.
"We'd better make a halt right here, boys," I said; "the horses seem
played out completely." So while Mac and Stewart were engaged in
the work of unloading them, Phil and I made a minute survey of our
surroundings. A huge breakwind guarded the circular space, and
behind it a well-padded track led backwards into a richly-foliaged
dell. Creeping plants and luxurious ferns grew in profession around
the base of a single lime-tree which found root in the hollow, and a
long wiry kind of grass flourished abundantly under its genial shade.
"I'll investigate the cause of such unusual vegetation," Phil said,
stepping forward.
"Look out for snakes," I warned; then turned to assist Mac in raising
poor "Sorrow," who had rolled over on the ground, pack-saddle and
all.
"The puir beastie's feenished," Mac said sorrowfully, "an' nae
wunner."
"Here's anither ane," wailed Stewart, and I looked up to see him
wildly endeavouring to keep "Sin" from falling on the top of sundry
cooking utensils. It was plain that two at least of the horses could go
no further if fortune did not speedily favour us.
"This is the deevil's ain countrie," groaned Mac helplessly, and for
the moment I felt utterly disheartened as I watched the poor
animals convulsively gasping on the sand.
43. A shout from Phil drew my attention. "There's a spring here, boys,"
he cried gleefully from the lime-tree hollow.
It was a welcome discovery; I had almost despaired of finding water
in the vicinity. "We'll camp for the day," I said, "and give our pack
train a much-needed rest."
The spring was a small one and beautifully clear; its waters gurgled
gently through a fissure in a white kaolin formation, and the surplus
flow was absorbed by the spreading roots of the climbing growths
mentioned. It was half hidden by an outjutting boulder, and further
cunningly screened from view by a heavy clump of overhanging
grass. Evidently the blacks were in the habit of camping here
frequently; the breakwind might have been erected for one night's
shelter, but the track towards the well had been long in use.
"I hope our landlords do not visit us to-night," Phil remarked, as we
gazed at each other through the smoke of our camp fire some little
time later.
"It wud be a vera onfort'nate happenin'," Mac grunted placidly,
drawing his gun closer.
"They're mebbe cannibals," suggested Stewart uneasily.
"We'll keep a watch in case of accident," I said; "but I don't expect
they'll give us any trouble."
But Stewart was still uneasy. "Their spears ha' an ex-tra-or'-nar'
bluid-thirsty look," he grumbled again, examining the double-barbed
weapons he had collected, "an' I hae nae faith whitever in they
black-skinned heathen."
However, the night passed without alarm, though we kept a careful
watch and were ready for an attack should any have been
attempted.
We continued our march next morning, and in less than half an hour
had emerged into open country, but now the surface soil was of a
hard, gravelly nature, liberally strewn with the iron pebbles so
abundant in more southerly latitudes. Straggling growths of mallee
44. and mulga spread everywhere, and at their roots reptiles and
numberless nameless pests seemed to abide. Black snakes writhed
across our path, centipedes squirmed over our boots, iguanas in
myriads started before our approach, and flying creatures with hard,
scaly wings rose from the shadeless branches and dashed into our
faces. Flies in dense clouds assailed us, causing indescribable
torture, and the diminutive sand insect was also extremely active,
seeking into our socks and ragged clothing despite our most
stringent precautions.
For over a week we journeyed across this dreary wilderness, nor did
we once observe a break in the horizon's even curve; the weather,
meanwhile, being of sweltering description. Then a dim haze
towards the north-east gradually outlined into a well-defined
mountain range as we advanced, and the country in general took on
a more irregular appearance. We were now nearing the line of the
explorer Wells's northward march, and I altered our course slightly in
order to intersect it at a point where a good water supply was
charted, for four days had elapsed since we had last discovered any
trace of moisture.
All that day we forced onwards wearily, the sun beating down upon
us mercilessly the while. No more desolate tract could be imagined
than that which lies in these latitudes: the motionless mallee and
mulga shrubs, the glistening beady surface over which we dragged
our feet, the quivering heat haze that so distorted our vision, and
the solemn stillness—the awful stillness of a tomb—all tended to
overwhelm the mind. A broken range of sandstone hills loomed
clearly out of the haze early in the afternoon, directly in our track,
and I again shifted the course so as to round their southern
extremity. Towards the south the sand wastes extended far as the
eye could reach, but east and north many mouldering peaks now
interrupted our view.
We found the spring without difficulty; it contained about forty
gallons of muddy water, over which a thick green scum had
gathered, and it was simply moving with animal life. Many bones of
45. doubtful origin lay heaped near to it; some were probably the
remains of kangaroos killed by the natives, of whom there were
numerous signs in the neighbourhood, but Phil insisted that not a
few human bones were among the bleaching mass. At the bottom of
the spring the complete vertebræ of several snakes and similar
reptiles almost wholly covered the chalky, impervious base, but how
these came to be there was a matter beyond my comprehension.
"Most probably," said Phil, "the natives like a snaky flavour in the
water."
"It mak's it extra paleetable tae them, nae doot," groaned Mac with
a shudder, "but I hae nae parshiality fur crawly bastes, even when
they're deid."
Stewart had by this time acquired a philosophical turn of mind.
"What's the guid o' growlin', Mac?" he snorted. "There's mebbe waur
than that tae come yet."
That we were in a district favoured by the blacks was very certain,
although we had not yet observed any of the dusky savages; three
or four breakwinds sheltered a space close to the spring, and the
ground was black with burnt-out smokes and charred logs. The
water, notwithstanding its pronounced medicinal flavour, was a great
improvement on the fetid solutions of the various soaks we had
encountered, and we decided to camp by it for several days, so as to
test the auriferous resources of the surface sands, which looked
rather promising, and also to give us time to make some much-
needed repairs in our tattered wardrobe.
The results of our experiments with the supposed auriferous country
proved too insignificant for more than a passing mention here. A few
colours were obtained, but nothing to give confidence to even the
most unambitious goldseeker. Rather disconsolately we prepared to
resume our march in a more N.E. direction, and three days later we
started on our altered course. The eternal sameness of things in the
Australian interior makes daily records of progress unentertaining
reading, and though each day's travel comes back to my mind now
46. as I write with painful vividness, yet it but cries out in the same
strain as its predecessor and follower, "Sand, sand, everlasting
sand."
For many miserable days and weeks we struggled eastward,
sometimes deviating to the north or south in vain endeavour to
escape unusually deterrent belts of the frightful wastes now so
familiar to us all.
Sometimes we would locate a soak or claypan when least expecting
such a find, and again, we might be reduced to almost certain
disaster before the water-bags were replenished at some
providential mudhole in our course. I do not wish to enlarge upon
the miseries of our journeyings; we took these willingly on ourselves
at the start, hoping for a compensating reward in the shape of
valuable knowledge; and is not experience always priceless?
Knowledge we did gain, it is true, but not of the kind we had over-
fondly anticipated; still, we had not yet reached the planned limit of
our expedition, and who knew what might await us in the dim,
shadowy mountain that stretched its cumbering height far on the
eastern horizon?
We had sighted this landmark nearly a week before, but having been
more than usually zealous in our search for the precious metal
among the outcropping iron formations now frequently encountered,
our rate of travel had been reduced to a few miles each day. Two of
the horses were still left us; the last of the ill-fated three had
succumbed from sheer exhaustion nearly fifty miles back, but "Sir
John" and "Reprieve," though no longer the high-spirited animals
they once were, still carried their jolting burdens of tinned meats,
flour, and extracts, though their steps were daily becoming weaker,
and their bright eyes clouding in a manner that foretold the worst.
The camels stubbornly paced ahead, with the great water-bags
tantalisingly lapping their tough hides, and the miscellaneous mining
implements perched on their hollow backs; they had already served
us well and nobly, and I devoutly hoped their vast energies would
bear them over the worst that lay before us.
49. EL DORADO!
We were now close on the 125th degree of longitude, which I had
marked as the limit of our eastward course, and my faith in more
northerly latitudes was so little, indeed, that I dreaded making any
change in our direction of travel.
"If we don't strike gold within the next couple of days," said Phil,
"there isn't much likelihood of our being overburdened with wealth
at the end of the trip."
Mac, who was pulling the nose rope of the leading camel, at once
lifted up his voice in protest.
"For Heaven's sake be mair pleasant wi' yer remarks, Phil," he cried.
"I was calculatin' on goin' home like a young millionaire——"
"You'll need to calculate again, then, Mac," interrupted Phil, "for I
don't think we'll get a red cent out of the ground on this journey."
But the complainer was not yet satisfied.
"What's the guid o' bein' a golologist?" he demanded wrathfully. "I
thocht——"
What he thought remained unspoken, for at that moment we heard
a scramble behind, and looking round we saw the doughty Mac and
his compatriot Stewart engaged in fierce conflict.
"I saw it first, ye red-heided baboon," roared the former, with
remarkable fluency of expression.
"The fact o' seeing it is naething—naething at a'," returned the other
with great complacency, "It's sufficient to say that I hae got it."
The camels, feeling the strain of guidance relaxed, had come to a
halt, and were now seemingly taking an interest in the squabble. It
was a rare thing for them to be left to their own devices, even for a
50. Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.
More than just a book-buying platform, we strive to be a bridge
connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.
Join us on a journey of knowledge exploration, passion nurturing, and
personal growth every day!
ebookbell.com