SlideShare a Scribd company logo
Mastering AngularJS for NET Developers 1st
Edition Majid Mohammad Wadood Mirzaei Golrokh
pdf download
https://textbookfull.com/product/mastering-angularjs-for-net-
developers-1st-edition-majid-mohammad-wadood-mirzaei-golrokh/
Download more ebook from https://textbookfull.com
We believe these products will be a great fit for you. Click
the link to download now, or visit textbookfull.com
to discover even more!
Mastering Corda Blockchain for Java Developers 1st
Edition Jamiel Sheikh
https://textbookfull.com/product/mastering-corda-blockchain-for-
java-developers-1st-edition-jamiel-sheikh/
Full Stack AngularJS for Java Developers: Build a Full-
Featured Web Application from Scratch Using AngularJS
with Spring RESTful 1st Edition Ravi Kant Soni (Auth.)
https://textbookfull.com/product/full-stack-angularjs-for-java-
developers-build-a-full-featured-web-application-from-scratch-
using-angularjs-with-spring-restful-1st-edition-ravi-kant-soni-
auth/
The Art of Coding: The Language of Drawing, Graphics,
and Animation Mohammad Majid Al-Rifaie
https://textbookfull.com/product/the-art-of-coding-the-language-
of-drawing-graphics-and-animation-mohammad-majid-al-rifaie/
M M Essential Anatomy 4th Edition Majid Alimohammadi
And Majid Doroudi
https://textbookfull.com/product/m-m-essential-anatomy-4th-
edition-majid-alimohammadi-and-majid-doroudi/
Kubernetes for Developers 1st Edition William Denniss
https://textbookfull.com/product/kubernetes-for-developers-1st-
edition-william-denniss/
Beginning AngularJS Grant Andrew
https://textbookfull.com/product/beginning-angularjs-grant-
andrew/
AngularJS Directives Vanston Alex
https://textbookfull.com/product/angularjs-directives-vanston-
alex/
Dependency Injection with AngularJS 1st Edition Knol
Alex
https://textbookfull.com/product/dependency-injection-with-
angularjs-1st-edition-knol-alex/
Cellulose Nanocrystals: Properties, Production and
Applications 1st Edition Wadood Y. Hamad
https://textbookfull.com/product/cellulose-nanocrystals-
properties-production-and-applications-1st-edition-wadood-y-
hamad/
Mastering AngularJS for NET Developers 1st Edition Majid Mohammad Wadood Mirzaei Golrokh
Mastering AngularJS for
.NET Developers
Master the art of developing applications using AngularJS,
ASP.NET Web API 2, and Visual Studio 2013
Mohammad Wadood Majid
Golrokh Mirzaei
BIRMINGHAM - MUMBAI
Mastering AngularJS for .NET Developers
Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the authors, nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
First published: April 2015
Production reference: 1230415
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78355-398-3
www.packtpub.com
Credits
Authors
Mohammad Wadood Majid
Golrokh Mirzaei
Reviewers
Abhishek Dey
Davide Guida
Weiqing Sun
Commissioning Editor
Ashwin Nair
Acquisition Editor
Usha Iyer
Content Development Editor
Natasha Dsouza
Technical Editor
Mrunmayee Patil
Copy Editors
Sonia Michelle Cheema
Neha Vyas
Project Coordinator
Rashi Khivansara
Proofreaders
Safis Editing
Paul Hindle
Indexer
Mariammal Chettiyar
Graphics
Sheetal Aute
Production Coordinator
Manu Joseph
Cover Work
Manu Joseph
About the Authors
Mohammad Wadood Majid has been working in the field of application
development and design for more than a decade for some major companies in
the USA. During this time, he has worked independently as well as with teams
to develop a number of highly successful enterprise applications for the Web and
mobiles. He is experienced in the development, designing, testing, modification,
and maintenance of enterprise applications. Currently, he is working as an
enterprise application administrator and developer and a part-time assistant
professor at the University of Toledo.
He has worked extensively with MVC, web APIs, ASP.NET, ADO.NET, C#, OData,
and RESTful. He has expertise in native mobile apps and web-based application
development that can be performed using HTML5, JavaScript, jQuery, Bootstrap,
AngularJS, and CSS.
He has experience of working with databases such as SQL Server 2012 and Oracle 11g.
He has also performed research on the following topics:
• Parallel implementation of algorithms on multicore and NVIDIA's GPU
• Parallel computation of moving target detection and recognition from a
set of radar signals
• Development of parallel programs using multicore and NVIDIA's GPU
for artificial intelligent algorithms, such as evolutionary neural networks
and genetic algorithms
I would like to dedicate this book to my parents for their support
and encouragement in all my endeavors. Especially, I would like to
thank my sister, Rabia, and her husband, Zafar, for their patronage.
Golrokh Mirzaei has several years of software development experience in the
software industry and is currently working as a faculty at the Ohio State University.
His research involves the development of software applications and multisensor data
fusion approach to monitor biological targets using three different sensors: infrared
camera (IR), radar, and acoustics. The infrared camera and radar sensors involve video
and image processing techniques, including object detection and recognition, feature
extraction, classification/clustering, and tracking. He has published several papers at
professional IEEE conferences and received several awards. His developments in the
field of image processing and computer vision are unique, related to multifidelity,
and multidisciplinary.
He has also performed research on the following topics:
• Pattern recognition (object detection, feature extraction, tracking, and so on)
• Machine learning (supervised/unsupervised learning)
• Classification/clustering
• Image/video/audio processing (infrared camera, radar, and acoustics)
• Bio-inspired computing (ACA, ACO, and GA)
• Bayesian inference and fuzzy reasoning
I would like to thank the Department of Information Technology at
the University of Toledo for giving me the opportunity to implement
the techniques described in this book in a real project, called the
Patient Handoff Tool.
About the Reviewers
Abhishek Dey, born in West Bengal, India, is a graduate student at University of
Florida, Gainesville, where he is conducting research in the fields of algorithms, data
structures, data mining, compiler design, computer security, and concurrency and
parallelism. He is a passionate programmer who started programming in C and Java
at the age of 10, and soon afterwards, developed a strong interest in web technologies
and system implementations. He possesses profound expertise in developing high
volume software using C#, C++, Java, JavaScript, jQuery, AngularJS, and HTML5.
He is a Microsoft Certified Professional, an Oracle Certified Java Programmer, Oracle
Certified Web Component Developer, and Oracle Certified Business Component
Developer. He has also contributed toward bringing new innovations in the field
of Highway Capacity Software Development at McTrans Center of University of
Florida (http://mctrans.ce.ufl.edu/mct/), which works in collaboration with
Engineering School of Sustainable Infrastructure and Environment (http://www.
essie.ufl.edu/).
In his leisure time, Abhishek loves listening to music, travelling to different,
interesting places, or painting on canvas, giving colors to his imagination.
More information about Abhishek Dey can be found at http://abhishekdey.com.
The best way to contact him is through his e-mail, contact.dey2015@yahoo.com.
Abhishek has reviewed Kali Linux CTF Blueprints and AngularJS UI Development,
both by Packt Publishing.
I'd like to thank my grandmother Aparna Dey, my aunties Mousumi
Dey and Mithu Mondal, and my great grandfather the late Sambhu
Nath Dey, for all the love and affection they have always showered
on me.
Davide Guida is a technical architect and technical delivery manager at Razorfish
Healthware (http://www.razorfishhealthware.com) in Salerno, Italy. He works
mostly with .NET and SQL projects and deals with the analysis and development
of complex client/server applications, remote services, and multimedia solutions.
He is also the lead architect and developer at Videum (http://www.videum.com).
He started programming at age of 5 when his mother, a math teacher, began teaching
him BASIC and Clipper on their Intel 286. He has a strong programming background
in C#, C++, JavaScript, SQL, and MongoDB. More information about Davide can be
found at http://davideguida.altervista.org.
Thank you mom for showing me the way and thank you Nadia for
pushing me to do my best.
Weiqing Sun is an associate professor of the computer science and engineering
technology program at the University of Toledo College of Engineering. He obtained
his PhD degree from the Computer Science Department of Stony Brook University
(SUNY Stony Brook) in 2008. He holds a BE and an ME degree in computer science
and engineering from Tongji University, Shanghai, China. Dr. Sun's primary research
interests lie in the areas of computer and network security (in particular, malware
defense and detection, security policy development, intrusion detection, and security
issues with unmanned aerial vehicles), cloud computing, healthcare information
systems, transportation information systems, and smart grids. In these areas, he has
published over 40 peer-reviewed papers and is currently advising a number of MS
and PhD students.
www.PacktPub.com
Support files, eBooks, discount offers, and more
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF
and ePub files available? You can upgrade to the eBook version at www.PacktPub.
com and as a print book customer, you are entitled to a discount on the eBook copy.
Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.com, you can also read a collection of free technical articles,
sign up for a range of free newsletters and receive exclusive discounts and offers
on Packt books and eBooks.
TM
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital
book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
• Fully searchable across every book published by Packt
• Copy and paste, print, and bookmark content
• On demand and accessible via a web browser
Free access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access
PacktLib today and view 9 entirely free books. Simply use your login credentials for
immediate access.
[ i ]
Table of Contents
Preface v
Chapter 1: Introduction 1
Understanding the need for client-side development 1
Client-side data binding libraries 3
Understanding AngularJS 4
What is AngularJS? 4
Why AngularJS? 5
Getting acquainted with the anatomy of AngularJS 10
Model 12
View 12
Controller 13
The AngularJS design pattern 13
Notable built-in directives 19
AngularJS – the conceptual overview 20
Templates 21
Directives 21
Filters 22
Services 23
Dependency Injection 25
The compiler 25
The overview of a single-page application 26
Benefits of SPAs 27
Summary 27
Table of Contents
[ ii ]
Chapter 2: Learning AngularJS Binding and Directives 29
Data binding 30
One-way binding 31
Two-way binding 31
Data binding in AngularJS 32
One-way data binding in AngularJS 33
Two-way data binding in AngularJS 34
Understanding directives 35
The first directive 37
The jQuery perspective 38
Basic behavior 40
The restrict property 40
The template and templateUrl properties 41
The scope property 42
Directive-to-directive communication 51
Summary 53
Chapter 3: AngularJS Scopes, Controllers, and Filters 55
Understanding the scope of AngularJS 55
AngularJS scope's chain of command 57
The AngularJS scope lifecycle 59
Adding behavior to the AngularJS scope 62
Understanding controllers 64
Controller inheritance 67
The AngularJS dot representation 69
Controller without scope 71
Understanding filters 72
The custom filter 73
Using a filter in a controller 75
Summary 77
Chapter 4: Communicating with the Server Using AngularJS 79
Communicating with the server using $http 80
Retrieving data with $http using GET 81
Configuring the $http request 84
Caching $http 88
Transforming request and response 90
Communicating with the server using RESTful services
and $resource 92
Authentication 95
Authentication with username and password 97
Securing applications 100
Summary 101
Table of Contents
[ iii ]
Chapter 5: Creating Applications Using AngularJS,
Entity Framework, and ASP.NET Web API 103
Using Entity Framework 103
Entity Data Model 106
Mapping 106
Entities 107
Relationships 107
Querying data 108
Creating a data model from an existing database 109
A web API 116
Why a web API? 116
Different API types 117
Web service APIs 117
Library-based APIs 118
Class-based APIs 118
Object-remoting APIs 118
Hardware APIs 118
Creating a web API using Visual Studio 118
LINQ 122
Using AngularJS with ASP.NET Web API 123
Summary 129
Chapter 6: Using AngularJS and ASP.NET Web API
for CRUD Operations 131
Web API routing 132
Routing with an action name 135
The ASP.NET Web API attribute routing 137
CRUD operation using $http 138
Using $http with the AngularJS factory 141
CRUD operations using $resource 145
The difference between $http and $resource 149
Securing the ASP.NET Web API 149
Summary 157
Chapter 7: Troubleshooting and Best Practices 159
Troubleshooting libraries and tools 159
Unit testing 161
What and what not to test 162
Unit testing using AngularJS 163
Module 163
Controller 164
Directive 166
Unit testing using Jasmine 168
Unit testing using Karma 170
Table of Contents
[ iv ]
AngularJS coding best practices 171
Organizing code 172
Piles 172
Drawer 172
Modularity 173
Common code 174
Using AngularJS 174
Summary 175
Appendix: Angular 2.0 177
Why Angular 2.0 177
Design and features of AngularJS 2.0 178
AtScript 179
Routing solution 179
Dependency Injection 180
Annotations 180
The instance scope 181
The child injector 181
Data binding and templating 181
Dynamic loading 181
Directives 182
Templates 183
Summary 185
Index 187
[ v ]
Preface
Application development is a broad term; it can range from developing the simplest
static page of plain text to the most complex database-driven, electronic business, and
social networking applications. A more comprehensive list of tasks that application
development commonly refers to may include, web designing, content development,
client relationships, client-side and server-side configurations, and deployments.
In the past, most developers developed server-side applications because of an
available server-side framework called Windows Presentation Foundation (WPF)
or web frameworks such as ASP.NET or Silverlight. These are used to create objects
containing data and bind them to user interface controls such as HTML. However,
improved browser features, faster JavaScript engines, and an increase in the usage of
mobile devices, such as iPads, iPhones, and Android tablets have definitely shifted
the trend from server-side to client-side development. However, data binding has
been difficult to implement into client-side application development because neither
HTML nor JavaScript natively support it.
It is possible to start client-side data binding from scratch; but, it is definitely
challenging and possibly not the best solution available. It is also very difficult to
maintain and reuse the code. To create a client-side application is an amazing ability,
although, the complexity involved in creating it is high. To develop a client-side
application involves manipulating the Document Object Model (DOM) in a browser
running JavaScript. One of the benefits of client-side applications is that HTML (DOM)
will be updated with the click of a button, rather than keeping a user waiting for the
server to respond. In the case of server-side rendering, it is very difficult to update
the portion of the page. Any portion of a page that's animated or highly interactive
(such as a draggable slider, sortable table, or a drop-down menu) almost certainly
uses client-side rendering.
Preface
[ vi ]
For the last several years, the application development landscape has changed
drastically because of an increase in the use of mobile devices, such as smartphones
and tablets. In 2013, mobile web traffic had increased substantially to almost a third
of the total web traffic; and it's expected is to increase in the near future. Applications
are expected to be able to work on different platforms, such as Windows, web, and
mobiles. In order to create multiplatform applications; an application should be
enabled to support diverse client browsers and plugins, such as Java and Adobe
Flash. The application becomes problematic if the plugins are not available or aren't
supported on all devices.
Client-side application development environments enable developers to slowly and
gradually replace applications, which are based on browser plugins with newer
versions of HTML, CSS, and JavaScript. While previous development tools would
abstract away the key elements of HTML, CSS, and JavaScript, client-side development
developed all these tools. Using client-side development, a programmer can now
render and manipulate content by focusing on client-browser capabilities. Several
client-side application development approaches, such as responsive page design and
progressive development are adopted to build modern web applications that include
single-page applications. The development process of these type of applications
is, however, challenging and costly when compared to other applications, because
they need rapid prototyping, rich client features, and a large JavaScript base to be
employed. Another JavaScript framework that has been developed in the same time
frame is the AngularJS framework by Google.
There are many libraries that have been introduced, such as QUnit in 2008, Jasmine
in 2010, and Backbone and Knockout.js in 2010. These libraries address challenges
that involve solving client-rich features. They use derivatives involved in a design
pattern, such as Model-View-Controller (MVC), which is common in both server
and client-sides. During the design, application data and business logic need to be
clearly differentiated. This differentiation is achievable by MVC patterns, and the
controller components sit in the middle. The controller has access to all the different
elements of the application, thus passing the data to and from the model, updating
the view, or responding to view changes that are passed to the model. There are
several advantages of using an MVC design pattern; these include reusing code
in a better manner (the same model can be used for multiple views), testability
(the controller can be tested from a view), and efficient development workflows
that are achieved due to the designer's ability to modify the view.
AngularJS can enhance and extend HTML by adding new elements to it and it
is based on the MVC pattern. It can also be tested from the start using modular,
composable code units. AngularJS has only grown in popularity since its
introduction in 2012.
Preface
[ vii ]
What this book covers
Chapter 1, Introduction, acquaints you to understanding the need for client-side
development and also to AngularJS. You will also get acquainted with the anatomy
of AngularJS and its conceptual overview. Finally, we will discuss the basics of a
single page application development process.
Chapter 2, Learning AngularJS Binding and Directives, focuses on showing you how the
AngularJS data binding works. You will also learn about the use and development of
AngularJS directives through code examples.
Chapter 3, AngularJS Scopes, Controllers, and Filters, the goal of this chapter is to
understand AngularJS scope as well as the controller and its use in AngularJS.
We will also cover the built-in filters of AngularJS and show you how to develop
a custom filter.
Chapter 4, Communicating with the Server Using AngularJS, focuses on how AngularJS
communicates with server-side code, such as web API, web services, or Data Access
Layer (DAL). In this chapter, we will discuss how to retrieve data from the server
using $http and $resources. This chapter also talks about the authentication and
security used for a AngularJS application.
Chapter 5, Creating Applications Using AngularJS, Entity Framework, and ASP.NET Web
API, focuses on how to connect to a database using Entity Framework. In this chapter,
we will discuss how to create a web API using ASP.Net and how to consume through
AngularJS.
Chapter 6, Using AngularJS and ASP.NET Web API for CRUD Operations, will start with
web API routing and then focus on how to Create, Read, Update, and Delete records
from a database using the ASP. Net web API and the AngularJS $http and $resource
directives. We will also discuss the difference between $http and $resource. At the
end of this chapter, we will talk about how to secure the ASP.Net web API.
Chapter 7, Troubleshooting and Best Practices, focuses on troubleshooting libraries and
tools for AngularJS. In this chapter, we will also discuss how to perform unit testing
of the Angular JS application using Jasmine and Karma. At the end of chapter,
we will go through the AngularJS coding best practices.
Appendix, Angular 2.0, introduces us to the Angular 2.0 framework. It may not
be a major update to the previous version, but is a complete rewrite of the entire
framework and includes significant changes. Here, we also talked about certain
Angular 2.0 changes. Angular 2.0 will hopefully be released at the end of 2015.
Preface
[ viii ]
What you need for this book
The minimum software requirement is Visual Studio Community 2013 or
Visual Studio 2013 Express web, which can be downloaded from https://www.
visualstudio.com/en-us/products/visual-studio-express-vs.aspx.
We recommend that you use Visual Studio 2013 Professional.
Who this book is for
This book is targeted at .NET developers who have basic experience in developing
web applications and have a fundamental knowledge of HTML, JavaScript, and CSS.
Conventions
In this book, you will find a number of text styles that distinguish between different
kinds of information. Here are some examples of these styles and an explanation of
their meaning.
Code words in text, database table names, folder names, filenames, file extensions,
pathnames, dummy URLs, user input, and Twitter handles are shown as follows:
"The broadcast() perform can send a message to all or any child controllers,
whereas the emit() perform can send a message to all or any ancestors."
A block of code is set as follows:
<myticker></myticker> <!--<!--<!--
<!--custom attributes - ->
<div data-myticker</div> <!--<!--<!--
<!--customer class names - ->
<div class="myticker"></div> <!--<!--<!--
<!--used like regular HTML elements - ->
New terms and important words are shown in bold. Words that you see on
the screen, for example, in menus or dialog boxes, appear in the text like this:
"As the page is loaded and we move our mouse over the Select car color
element, the jQuery dialog box shows the My favorite color is message."
Warnings or important notes appear in a box like this.
Preface
[ ix ]
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about
this book—what you liked or disliked. Reader feedback is important for us as it helps
us develop titles that you will really get the most out of.
To send us general feedback, simply e-mail feedback@packtpub.com, and mention
the book's title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide at www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to
help you to get the most from your purchase.
Downloading the example code
You can download the example code files from your account at http://www.
packtpub.com for all the Packt Publishing books you have purchased. If you
purchased this book elsewhere, you can visit http://www.packtpub.com/support
and register to have the files e-mailed directly to you.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do
happen. If you find a mistake in one of our books—maybe a mistake in the text or the
code—we would be grateful if you could report this to us. By doing so, you can save
other readers from frustration and help us improve subsequent versions of this book.
If you find any errata, please report them by visiting http://www.packtpub.com/
submit-errata, selecting your book, clicking on the Errata Submission Form link,
and entering the details of your errata. Once your errata are verified, your submission
will be accepted and the errata will be uploaded to our website or added to any list of
existing errata under the Errata section of that title.
Preface
[ x ]
To view the previously submitted errata, go to https://www.packtpub.com/books/
content/support and enter the name of the book in the search field. The required
information will appear under the Errata section.
Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all
media. At Packt, we take the protection of our copyright and licenses very seriously.
If you come across any illegal copies of our works in any form on the Internet, please
provide us with the location address or website name immediately so that we can
pursue a remedy.
Please contact us at copyright@packtpub.com with a link to the suspected
pirated material.
We appreciate your help in protecting our authors and our ability to bring you
valuable content.
Questions
If you have a problem with any aspect of this book, you can contact us at
questions@packtpub.com, and we will do our best to address the problem.
Introduction
The goal of this chapter is to understand the need for client-side development and to
understand AngularJS. We will also get acquainted with the anatomy of AngularJS
and its conceptual overview. Finally, we will discuss the basics of a single-page
application development process. This chapter is organized as follows:
• Understanding the need for client-side development
• Understanding AngularJS
• Getting acquainted with the anatomy of AngularJS
• The conceptual overview of AngularJS
• Learning the basics of a single-page application
Understanding the need for client-side
development
Application development is a broad term; it can range from developing a simple,
static page of plain text to developing the most complex database driven electronic
businesses and social network applications. A more comprehensive list of tasks,
which application development commonly refers to, may include web designing,
content development, client relationship, client-side configuration, server-side
configuration, and deployment.
Introduction
[ 2 ]
In the past, most developers were developing server-side applications because of the
available server-side frameworks. Windows Presentation Foundation (WPF) or web
frameworks, such as ASP.NET or Silverlight, are used to create objects that contain
data and to bind them to user interface controls, such as HTML. However, improved
browser features, faster JavaScript engines, and the increase in the usage of mobile
devices, such as iPad, iPhone, and Android devices, have definitely shifted the
trend from server-side to client-side development. However, data binding has been
difficult in client-side application development because neither HTML nor JavaScript
natively supports data-binding.
It is possible to achieve client-side data binding from scratch; however, it is definitely
challenging and possibly not the best solution available. It is also very difficult
to maintain and reuse the code. To create a client-side application is an amazing
ability although the complexity involved in creating a client-side application is high.
To develop a client-side application means to manipulate the Document Object
Model (DOM) in a browser that runs JavaScript. One of the benefits of client-side
applications is that HTML (DOM) will be updated with the click of a button, rather
than the user waiting for the server to respond. In the case of a server-side rendering,
it is very difficult to update the page. Any portion of a page that's animated or highly
interactive (a draggable slider, sortable table, drop-down menu) almost certainly
uses client-side rendering.
For the past several years, the application development landscape has changed
drastically because of the increase in the use of mobile devices, such as smartphones
and tablets. In 2013, mobile web traffic increased substantially to almost a third
of the total web traffic; this web traffic is expected to increase in the near future.
Applications are expected to be able to work on different platforms such as
Windows, web, and mobile. In order to create multiplatform applications, the
application should support the diversity of client browsers and plugins, such as Java
and Adobe Flash Player. This is because an application becomes problematic if the
plugins are not available or not supported on all devices.
A client-side application development environment enables developers to slowly
and gradually replace applications based on browser plugins with newer versions
of HTML, CSS, and JavaScript applications. While previous development tools
would abstract away the key elements of HTML, CSS, and JavaScript, client-side
development embraces all these tools. Using client-side development, a programmer
can now render and manipulate content by focusing on client-browser capabilities.
Several client-side application development approaches, such as responsive page
design and progressive development are adopted to build modern web applications
that include single-page applications.
Chapter 1
[ 3 ]
The development process of these types of applications is however challenging and
costly when compared to other applications because these applications need rapid
prototyping, rich client features, and a large JavaScript base for them to be employed.
Another JavaScript framework that has been developed in the same timeframe and is
widely used for developing single-page applications is the AngularJS framework by
Google.
There are many libraries that have been introduced, such as QUnit in 2008, Jasmine
in 2010, and Backbone.js and Knockout.js in 2010. These libraries address the
challenges that are involved in solving the rich client features. These libraries use
derivatives for a design pattern, such as Model-View-Controller (MVC), which is
common in both server-side and client-side. During the design, application data and
business logic need to be clearly differentiated. This differentiation is achievable by
MVC patterns where the controller components sit in the middle. The controller has
access to all the different elements of the application; thus, it passes the data to and
from the model, updates the view, or responds to view or changes that are passed to
the model. There are several advantages of using the MVC design pattern, such as
better code reuse (same model can be used for multiple views), testability (controller
can be tested from view), and efficient development workflow that is achieved due to
the designer's ability to modify the view.
AngularJS can enhance and extend HTML by adding new elements to it and
AngularJS is based on the MVC pattern. It can also be tested from the start using
modular, composable code units. AngularJS has grown in popularity since its
introduction in 2012.
Client-side data binding libraries
The use of client-side data binding is becoming more widespread as more and
more developers are writing client-side applications. Most of these libraries follow
the MVC or Model-View-ViewModel (MVVM) design pattern and some of these
libraries directly integrate with the server framework, such as Knockout.js.
The following table illustrates the list of a few client-side data binding libraries that
can be used for a client-side application development:
Library name Description
AngularJS AngularJS uses the MVC and MVVM design pattern.
Backbone.js Backbone.js follows the MVC design pattern for data binding and
uses key/value binding as well as customer events.
Derby Derby provides a framework that runs in the browser and supports
data binding and templates.
Introduction
[ 4 ]
Library name Description
Ember Ember uses templates that update the DOM automatically as the
data changes.
jQXB Expression
Binder
jQXB Expression Binder is a jQuery plugin that supports two-way
data binding and it is very lightweight.
JsViews JsViews is a data binding framework that binds views through the
JsRender template.
KnockoutJS KnockoutJS uses the MVVM design pattern and directly integrates
with the server framework.
Meteor The Meteor framework uses Node.js on server side and supports
data-binding on client side.
Simpli5 Simpli5 is a JavaScript framework that provides support for two-
way data-binding.
Nowadays, the cross-platform application development that uses the client-side
binding is more popular. Most of the client-side script libraries retrieved from the
server using the JavaScript Object Notation (JSON) format and dynamic binding of
the HTML elements can be achieved by employing the JSON format. This is because
JSON uses multiple client-side libraries and it is an advanced subset of JavaScript
itself. JSON is a preferred client-side application format that parses and transmits
data using a lightweight framework, making reading and writing of data easier.
Understanding AngularJS
The popularity of developing client-side applications for mobile devices, such as
iPhones, iPads, and Android tablets is a direct result of market penetration and a
growing user base for these devices. Moreover, JavaScript, the MVC framework,
and other libraries, such as Backbone.js, Node.js, and so on, have been released
and adopted in the mainstream programming. In this section, we will discuss what
AngularJS is and its importance.
What is AngularJS?
AngularJS is a client-side JavaScript library, which has been developed based on the
MVC design pattern. AngularJS is used for client-side data binding of client-centric
applications. It is open source and used by Google Inc. and its Google community.
AngularJS assists to create a client-side application that needs HTML, CSS, and
JavaScript. AngularJS's JavaScript framework is an effort taken to make both
development and testing of application easier.
Chapter 1
[ 5 ]
AngularJS contains additional custom HTML tags. It submits the directives in those
custom HTML tags and binds the HTML elements in client side with a model's
data using standard JavaScript. The values of the JavaScript variables can be set or
retrieved dynamically with JSON resources.
The way AngularJS's data binding and dependency injection works is that it helps
to write very less or no code for the client-side binding. AngularJS is a structural
framework for dynamic application development. It lets HTML express an
application's components very clearly and concisely within the browser. AngularJS
proves to be a good candidate to work with the server technology and especially
with ASP.NET and Microsoft's MVC.
These days, AngularJS is popular because it extends HTML with additional elements
to create a template and to enable DOM for one-way or two-way binding. In real
applications, in addition to data binding between view and model, executing the
business logic depends on servers. AngularJS has a very rich, built-in support
to communicate with the server and it also provides a built-in wrapper for
communication with RESTful services.
Why AngularJS?
AngularJS proceeds by minimizing the impedance mismatch between an
application's need for constructing a new HTML and document-centric HTML. Thus,
as compared to other available libraries, it takes a different approach. Directives are
used in AngularJS to convey to the browser how to use a new syntax. Some of the
examples of the directives are:
• Data-binding, as in {{}}
• The two-way binding facility in AngularJS enables automatic change of
either the target or source property in case one of them changes
• Control structures for repeating and hiding a certain portion of a page
• AngularJS sustains the client-side form validation
• AngularJS connects the server-side code to DOM elements using JSON
• AngularJS provides a way to group HTML to reusable components
• AngularJS contains the Hypertext Transfer Protocol service, which can be
used to communicate with remote servers
Introduction
[ 6 ]
AngularJS has been developed in the belief that it can be used to solve problems that
don't require the developer to specify any extra procedures.
The following are the design goals of AngularJS:
• To separate DOM operations from the application logic. This dramatically
improves the testability of the code.
• Application testing is of equal importance to application writing. Testing is
difficult and dramatically affects the way the code is structured.
• Separation of the client side of an application from the server side. This
allows development work to continue in parallel and allows reuse of both the
sides.
• During the entire lifecycle of building a client-side application, the AngularJS
framework helps developers to create a user interface (UI), write business
rules, debug, and test the applications.
In developing client-side applications, AngularJS is not a single piece in the overall
package of the AngularJS framework. AngularJS puts the DOM and AJAX code in
a well-defined structure. This makes AngularJS opinionated about how a CRUD
application should be built. AngularJS has the following features and advantages:
• Implement the CRUD operation, data-binding, basic directives,
form validation, routing, deep-linking, reusable components, and
dependency injection.
• Application testing, such as unit-testing, end-to-end testing, mocks,
and test harnesses.
• Kernel application with directory layout and test scripts as a starting point.
• The AngularJS framework is developed based on the MVC design pattern. It
manages these components and connects them to server.
• AngularJS uses additional HTML tags to create a user interface for
applications. It is much easier, more natural, and less complex than creating
a user interface using JavaScript. Creating a user interface with AngularJS
within HTML is easy to organize; special tags in the DOM determine which
controllers to use for each element. The new tags regulate what should be
loaded. AngularJS directives make client-side application development
easier because in AngularJS, what you see is what you get. So, instead
of wasting time thinking and deciding what has to be done, one can just
use the AngularJS framework to simply define what you want and what
dependencies are involved.
Chapter 1
[ 7 ]
• The AngularJS framework uses Plain Old JavaScript Objects (POJO).
Therefore, AngularJS does not need the getter or setter functions. We can
directly add properties and loops into the objects. The code looks much
cleaner and more organized. The traditional data model is responsible
for data determination and server synchronization. AngularJS uses the
data model, which uses plain objects; these objects behave like temporary
storage areas to store and retrieve data. AngularJS's data model works very
closely with controller and view and is known as scope. All the properties
of the scope object are automatically bound to the calling view of the scope.
AngularJS keeps track of the changes made to these properties and updates
the view automatically when needed. There is no data in the scope, which
depends on the controller to feed the data into the scope, according to the
business logic.
• The AngularJS framework brings additional functionality to the DOM by
introducing supplementary tags to HTML, which are known as directives.
Directives empower us to invent our own HTML tags. The MVC application
can be separated by putting all DOM manipulations into the directives. This
separation will permit the MVC application to only focus on updating view
with new data. Directives come in the form of custom HTML tags, such as:
<myticker></myticker> <!--<!--<!--
<!--custom attributes - ->
<div data-myticker</div> <!--<!--<!--
<!--customer class names - ->
<div class="myticker"></div> <!--<!--<!--
<!--used like regular HTML elements - ->
• Directives are designed to be standalone reusable elements separate from
the application. In fact, if a particular element is adopted by the HTML5
standard, it should be as simple as removing the custom directive. The
application should behave in exactly the same manner without needing
to change the application. The controller should not manipulate the DOM
directly. All DOM manipulations should be performed by directives.
Introduction
[ 8 ]
• The AngularJS framework provides out-of-the-box filter functions. A filter
is a separate function like the directive. A filter will filter the data before the
data is bound to the view. It is capable of creating a sortable HTML table
without writing any JavaScript. In an application, different filters can be
applied, such as "currency," which will convert a number into the currency
format, "lowercase," which will convert the string to lowercase, "orderBy,"
which will order the list of items in the ascending or descending filter,
and much more. We can also create a custom filter instead of using the
out-of-the-box filter.
• All the points up till now mean that you get to write less code. You don't
have to write your own MVC pipeline. The view is defined using HTML,
which is more concise. Data models are simpler to write without getters/
setters. Data-binding means that you don't have to put data into the view
manually. Since directives are separate from the app code, they can be
written by another team in parallel with minimal integration issues. Filters
allow you to manipulate data on the view level without changing your
controllers. Yes, this is sort of a summary bullet point, but writing less code
is a big deal!
• Controllers in AngularJS are functions, which are used to govern the scope.
For example, you will use the controller to prefill the data into the scope
from the server or to implement business logic validations. In contrast to
alternative frameworks, controllers are not objects and there is no inheritance
involved. If controllers are easy, then where the work ought to be performed?
AngularJS introduces services to do just that. Services are specifically what
they sound like. They should not get entangled with the MVC of your
application by merely offering associate outward API to reveal no matter
what you wish it to reveal. Most of the time, the service syncs up to a server
to keep up the associate offline data store and exposes ways to push and pull
information to and from a server. AngularJS produces a resource sharing
service that enables multiple controllers to share an equivalent resource.
Services are designed to be standalone objects that cut loose your application.
They permit your controller to stay lean and dedicated to the view and scope
that they are assigned to. Services are mainly used to replace the concept of
class in object-oriented programming. Of course, implementation of services
is not needed and it's utterly acceptable to try and do some lightweight lifting
within your controller to avoid over complexness.
Chapter 1
[ 9 ]
• A PubSub system is a pretty common tool that permits decoupled
communication. A PubSub patterned communication between a publisher
(sender) and subscriber (receiver) involves transmitted messages
characterized as classes, instead of being passed as entire messages.
Most PubSub implementations on the Web are not aware of the context.
Typically, you would wish a PubSub message to be only legible to the
children of a selected node or solely readable by the ancestors of a selected
child. In other words, typically, you do not need unrelated MVC parts to
read your messages. The PubSub system in AngularJS is exactly that. The
broadcast() perform can send a message to all or any child controllers,
whereas the emit() perform can send a message to all or any ancestors.
However, PubSub is not the only way to communicate with controllers. In
fact, if all you are doing is telling different controllers to update their views
once a property changes, you must want data binding. However, what I
did not tell you is that scopes inherit the properties of their parent scopes.
This means that if a property exists on the parent scope and a child scope
modifies it, then all different scopes that inherit from the constant parent will
see constant modification; their views will be updated mechanically by the
current version of AngularJS.
• The whole of AngularJS is coupled along by Dependency Injection (DI).
This is what it uses to manage your controllers and scopes. As a result, all of
your controllers depend on DI to pass information in order to perform unit
testing by injecting mock information into your controller and measuring
the output and behavior. In fact, AngularJS already incorporates a mock
communication protocol supplier to inject faux server responses into the
controllers. This beats the additional ancient approach of taking a look at the
acting Internet applications by making individual test pages that invoke one
part, then interacting with it to envision whether or not it works.
The preceding points should provide ample explanation as to why AngularJS is so
useful and powerful. Not all web apps use AngularJS. For instance, if you're writing
a game or a computationally intensive mathematics program, there's no reason why
AngularJS would suit your explicit downside domain. Except for generic Internet
apps, it ought to function as a viable framework.
Introduction
[ 10 ]
Getting acquainted with the anatomy of
AngularJS
In AngularJS applications, view is the Document Object Model (DOM), controllers
are the JavaScript functions, and the model data keeps object properties. We need to
understand that MVC is needed for many reasons. First, it offers you a mental model
for where to place what; therefore, you do not need to invent it each time. Other
people collaborating on your project will take a moment to understand what you've
written, as they may perceive that you have victimized the MVC structure because
you have added your code. Maybe most significantly, we'll claim that it delivers nice
edges in creating your app easier to grow, maintain, and test.
AngularJS is constructed around the belief that declarative programming ought to
be used to build user interfaces and wire software package components, whereas
imperative programming is great for expressing business logic. The framework
adapts and extends ancient HTML to raise and serve dynamic content through
two-way data binding that permits the automated synchronization of models and
views. As a result, AngularJS de-emphasizes DOM's manipulation and improves its
testability and performance.
Separation of the HTML DOM (view) from the application logic (controller)
improves the testability of the code in the following way:
• Regard application testing to be of equal importance to application writing.
Testing issue is dramatically laid low with the method with which the code is
structured.
• Decouple the client side of the associate degree application from the server
side. This permits development work to progress in parallel and permits
recycling of either side.
• Provides structure for the journey of building associate degree application
from planning the UI, through writing the business logic, to testing.
Random documents with unrelated
content Scribd suggests to you:
the stern millionaire, whose heart was steeled against the calls of
common humanity. Thus did he argue with himself as to the good
that would be done by making the disclosure to Nansie; it would but
intensify the sorrow caused by Kingsley's silence into a torture which
would be unendurable. If any useful end could have been served by
letting Nansie into the secret of her husband's peril Mr. Loveday
would not have hesitated to inform her of it; but, so far as he could
see, the distress of mind occasioned by the revelation would add
misery to misery; and, after some long consideration of the matter,
he determined to keep the matter to himself, at least for the
present. Meanwhile he watched the papers for further information of
the railway accident, but for some time saw no reference to it. One
day, however, the following paragraph arrested his attention:
"With respect to Mr. Seymour who met his death in the railway
accident in Germany, the particulars of which have been fully
reported in our columns, it is now certain that he was by birth a
Russian, and that he was for a number of years intimately connected
with conspiracies against law and order. The documents found upon
his person were of such a character, and were so drawn out, as to
destroy the hope that was entertained that they would lead to the
detection of the members of the secret societies with which he was
associated. Great pains have evidently been taken--probably from
day to day--to do away with all documentary evidence that would
incriminate others, and this is an indirect proof of the dangerous
nature of the conspiracies in which he was engaged. With respect to
the Mr. Manners who met with serious injuries, nothing to directly
implicate him has come to light. The strongest point against him is
the fact of his having travelled for many months with Mr. Seymour
on apparently confidential relations. Papers found in his possession
lead to the conclusion that he is the son of the great contractor, Mr.
Valentine Manners, whose name is known all the world over."
In the following day's paper Mr. Loveday read a letter to the
following effect:
"Sir,--It is necessary for me to state that I have not been in any way acquainted
with the late movements and proceedings of my son, Mr. Kingsley Manners, who is
reported to have met with serious injuries in a railway accident in Germany, nor
have I any knowledge of the Mr. Seymour with whom he is said to have travelled
as companion.
"Faithfully yours, Valentine Manners."
That was all. Although Mr. Loveday carefully searched the papers
day after day, he saw no further reference to the matter; it dropped
out of sight, as it were, and the faint interest it had excited in the
public mind appeared to have died completely away. The hard battle
of life continued sadly and monotonously, without the occurrence of
one cheering incident to lighten the days; and as time wore on
Nansie ceased to speak to her uncle of the beloved husband who
was either dead or had forgotten her. In her sad musings upon the
question of death or forgetfulness she did not bring the matter to an
issue. Had she been compelled to do so, she would have stabbed
herself with the torture that Kingsley was dead; for that he could
have forgotten her, and that he could be systematically neglecting
her, was in her faithful, chivalrous heart impossible. All that she
could do was to wait, although hope was almost dead within her.
At an unexpected moment, however, the question was solved.
It was evening. Mr. Loveday had not returned from his daily
labors, and Nansie had put her baby asleep in her cradle, and had
gone out to execute some small household duties. She hurried
through them as quickly as possible, and, returning home, had
almost reached the street door of the house in which she lived,
when a voice at her back said,
"It is Nansie!"
The pulses of her heart seemed to stop. It was her husband's
voice, and so overcome was she by this sudden ray of sunshine that,
when she turned, she could scarcely see before her. Again the voice
came to her ears; the gay, light, happy voice of old, which expressed
only joy and sweetness, and in which there was no note of sadness
or sorrow.
"Why, Nansie--it is Nansie! I was born under a lucky star."
And still, without seeing the speaker, she felt herself drawn to the
heart of the one man in the world she loved--of the dear husband
and the father of the babe sleeping peacefully at home.
"Oh, Kingsley! Is it you, is it you?"
"Of course it is, Nansie. Who else should it be? But it is very
perplexing and puzzling; I don't quite see my way out of it. Tell me,
Nansie--you expected me, did you not?"
"Yes, Kingsley, yes--for so long, for so long!"
"No, no, not for so long. Why, it can have been but a few days
since I went away! Let me see--how was it? We had to look things in
the face, and we did, and we agreed that something must be done,
and then--and then--upon my word, Nansie, I think I am growing
worse than ever; I not only fly off at a tangent, but I seem to be
afflicted by an imp of forgetfulness. What does it matter, though? I
have found you, and we are together again."
During this speech Nansie's eyes were fixed upon his face in
tender love and thoughtfulness. His words were so at variance with
the true nature of her position and his that she would have been
unable to understand them if love had not brought wisdom to her.
There was in Kingsley's eyes the same whimsical expression as of
old, there was in his manner the same light-heartedness which had
enabled him to look upon the future without anxiety, the tones of his
voice were clear and gay, but he bore about him an unmistakable air
of poverty. His clothes were worn threadbare, his hands were
attenuated and almost transparent, and the lines of his face denoted
that he had passed through some great suffering. He evinced no
personal consciousness of these signs, and seemed to be at peace
and in harmony with himself and all around him.
"Are you well, Kingsley?" asked Nansie, solicitously.
"Well, my love? Never was better in my life, and now that I have
found you, there is nothing more to wish for. And yet--and yet--"
He passed his hand across his forehead, and looked at her in a
kind of humorous doubt.
"Do you observe anything singular in me, my love?"
It would have been cruel to have answered him with the direct
truth. It was from the deep well of pity with which her heart was
filled that she drew forth the words,
"No, Kingsley, no."
"Are you sure?"
"Yes, dear."
"I am glad to hear you say so, Nansie. I am the same as ever,
eh?"
"Yes, Kingsley, the same as ever; but we will not part again."
"No, indeed! I don't intend that we shall--because, although we
have been separated but a short time, my head has got full of
fancies about this and that--foreign countries--outlandish places--
strange people--rapid journeys--accidents even, but dreams, all of
them, Nansie. They must be dreams, or I could fix them with greater
certainty. Now, you know my old way, my dear; when anything was
troubling me I used to say, 'What is the use? It won't make things
better.' There is only one wise way to look upon life--make light of
things. You remember a favorite saying of mine--it was from a song,
I think, was it not? 'Never trouble trouble, till trouble troubles you.'
And that is the way we will go through life together, eh, my love?"
"Yes, Kingsley," said Nansie, and would have said more, but for a
sudden trembling that came over him, which caused him to cling to
her for support.
"What is the matter, Kingsley?"
"To tell you the truth, my dear," he replied, with a wan, whimsical
smile, "you would hardly believe it, but I think I am hungry!"
"Hungry! Oh, Kingsley!"
"Well, yes; such a careless, neglectful fellow as you have got for a
husband, Nansie, never thinking of things at the right moment,
never taking into account that it is necessary to eat even, until it is
forced upon him that he must eat to live. And talking of eating to
live--is there anything in the larder, Nansie?"
He had rallied a little, and spoke with greater firmness.
"Yes, Kingsley, plenty; come--come. Ah, my dear, my dear, with all
my heart I thank God that you are with me again!"
"Dear wife," he murmured, and allowed himself to be led by her
into the house, and up the dark stairs to the rooms she occupied.
But outside the door, on the landing, she whispered to him,
"Kingsley!"
"Yes, love."
"There is a great happiness within. Be prepared for it."
"There is a great happiness here"--with his arms around her. "I
am really and truly thankful."
"But a greater within, Kingsley, my husband. Listen--our darling
child sleeps there."
"Our darling child, our little one! Surely I have seen her in my
dreams, in which I have seen so many strange things. Ah, how I
have dreamed of you, Nansie, even during this short absence! But
let us go in, or I shall be reproached for forgetfulness."
They entered the room together, they leaned over the cradle, they
knelt by its side, and Kingsley, lowering his face to the pretty babe
sleeping there, kissed her softly and tenderly.
"She is very sweet, Nansie, like you. I am sure her eyes are the
color of yours."
"No, darling, she has your eyes."
"And your heart, Nansie. Happy little one, happy little one! We will
make her happy, will we not, dear?"
"Yes, Kingsley."
"But, my dear, pardon me for saying so, I am really and truly
hungry. Even a piece of dry bread would be acceptable."
She kept back her tears, and quickly placed bread upon the table,
which he ate ravenously at first, smiling at her gratefully the while.
Very soon she had prepared some hot tea, which he drank, and
begged her to drink a cup with him. His hunger being appeased, he
lay back in his chair, his eyes wandering round the room.
"What is our dear little one's name?" he asked; "I have forgotten
it."
"No, dear," said Nansie, "you have not forgotten it, because she
has not one yet; we call her 'baby,' you know."
"Yes, yes," he said, "'baby,' of course, the best, the sweetest that
ever drew breath; but she must have a name, Nansie; she cannot go
through life as 'baby.' Say that when she is a happy woman she
marries, it would not do for her to be called 'baby' then."
"We waited for you, Kingsley, to give her a name."
"Well, then, what shall it be? But that it would introduce confusion
into our little home, no better name than 'Nansie' could be found.
That would not do, would it?"
"No, Kingsley. Shall we give her your mother's name?"
"My mother's? No, there must be none but good omens around
her. Your mother's, Nansie. I remember you told me it was Hester."
Then he called aloud, but in a gentle voice, "Hester!"
"She is awake, Kingsley," said Nansie, lifting the baby from the
cradle and putting her into his arms.'
"This is a great joy to me," he said; "I really think she knows me;
we shall be the best of friends. There is so much that is good in the
world to show her--to teach her. Now, you and I together, love, will
resolve to do our duty by her, and to do all that is in our power to
make her happy."
CHAPTER XXVII.
An hour later, when Mr. Loveday returned home, Nansie, who had
been listening for his footsteps, went out to meet him. Even in the
dark he, with love's keen sight, observed that something of a
pleasant nature had occurred.
"Good news, Nansie?"
"Speak low, uncle. Yes, good news. He has come home."
"Kingsley?"
"Yes, uncle. He is asleep with the baby by his side. He is very,
very tired."
"How did it happen? How did he find you out?"
"It must have been almost by chance. I was out making some
little purchases, when I suddenly heard a voice behind me saying,
quite naturally, 'It is Nansie!' Turning, I saw him, not clearly at first,
because I was almost blind with joy. You must be very gentle with
him, uncle."
"I will, my dear; but there is something in your voice--gentle for
any especial reason?"
"Yes, for a special reason, which you will more fully discover for
yourself. I am glad that I have seen you before he meets you; it will
be better that you should be prepared."
"Prepared for what, my dear?"
"Kingsley is laboring under an impression that he has been away
from us but a very short time. What we know to be real he believes
to be fancies. He has made no reference to his travels abroad with
Mr. Seymour, nor to the railway accident in which he was injured. He
speaks of dreams, and even then not clearly. It is difficult for me to
make myself understood--"
"Not at all, Nansie; I think I understand. The accident he met with
has affected his memory; but it is good that he is with us now. We
can take care of him, we can nurse him back to strength and
health."
"How kind you are, uncle! Never thinking of yourself!"
"Nonsense, my dear, nonsense! It is entirely of myself that I am
thinking, for I would not lose you and your dear ones for all the
money the world contains. That is putting a small value upon money,
though. I wish we had a little."
In his mind was the thought, "We need it all the more now," but
he did not give the thought utterance.
"Is he low-spirited, despondent, Nansie?"
"No, uncle, quite the contrary. He is as light-hearted and gay as
ever, and speaks in the same sweet, hopeful strains of the future, his
anticipations of which led him into the error of--"
She stopped short; she did not complete the sentence. Her uncle
completed it for her.
"Of marrying you, my dear. Do not regret it; accept it as a
blessing, as it really is. Short-sighted mortals as we are to so
constantly forget that life is short, and that its sweetest happiness is
to be found in self-sacrifice--even, Nansie, in suffering!"
They entered the room together, and found Kingsley awake. He
rose when his eyes lighted upon Mr. Loveday, and, with a bright
smile, said:
"Nansie's uncle?"
"Yes, Kingsley," said Mr. Loveday.
And Nansie raised her uncle's hand to her lips, and kissed it in
grateful recognition of the affectionate greeting.
"Now," said Kingsley, to whom strength seemed to have really
returned; he held out his hand, and retained Mr. Loveday's in his as
he spoke--"now what could be pleasanter, what could be brighter
and more full of promise? Here, for the first time, we meet, and I
recognize in you a friend. Believe me, sir, when I say a friend, it is
said once and forever; it is meant once and forever. I am no
butterfly, eh, Nansie?"
"No, dear Kingsley," she replied, pressing close to him.
He passed his arm round her.
"No butterfly," continued Kingsley, "except in the way of
conversation, but that you will find out for yourself. I fly from one
theme to another in the most inconsequential manner. A bad habit,
sir, if it really meant anything serious, but it does not, and I have
here by my side a spiritual support"--he kissed Nansie--"which never
fails to recall me to the straight line at the precise and proper
moment--as it does now; for looking at her, I am reminded of all we
owe to you. Let me thank you in our joint names. I will not say that
I hope to live to repay the debt, because there are some debts
which it is good never to repay, and this is one. It is sometimes most
ungracious to deliberately cancel an obligation."
"The debt is on my side, Kingsley," said Mr. Loveday, greatly won
by the returned wanderer's speech and manner. "Nansie has
brightened my life."
"She could do no less," said Kingsley, in a tone of grave and
tender affection, "to the life of any person who has the happiness to
know her."
Upon the invitation of Mr. Loveday, who knew, now that Kingsley
had joined them, that certain changes were necessary in their
domestic arrangements, and that Nansie could more readily effect
them if she were left alone, the two men went out for a stroll. They
returned after an absence of a couple of hours, and Kingsley
presented Nansie with a few simple flowers, saying as he did so:
"Our honeymoon is not yet over, my love."
Presently Kingsley, who, it was apparent, needed repose, was
induced to retire to his bed. No sooner had he laid his head upon the
pillow than he was fast asleep. Nansie and her uncle sat together in
the adjoining room, and conversed in low tones.
"It is as you say," observed Mr. Loveday, "he appears to have no
memory--that is, no absolute, dependable memory--of what has
transpired from the time he left you. I have not directly questioned
him, feeling that it might not lead to a good result, and that he is
not yet strong enough to bear even a slight shock; but indirectly I
threw out a veiled suggestion or two, and his responses have
convinced me of his condition. He has a vague impression of a
railway accident in which some person whom he knew was killed,
and some person whom he knew was injured, but he does not
associate either the one or the other directly with himself. You will
not mind my mentioning something, my dear, because in our
position there must be between us no concealment. Kingsley has no
money, not a penny."
"It is as I expected, uncle; but how did you discover it? Did he say
so?"
"No, my dear, it came when he paused before a woman who was
selling flowers. He put his hands into his pockets, and was, I think,
more perplexed than distressed. 'Now this is too bad,' he remarked,
and I, divining, paid the woman for the flowers he selected. It is
wonderful to me how, circumstanced as he is, he managed to make
his way home."
"Providence directed him, and protected him," said Nansie,
devoutly, "and will surely smooth the path before us."
"With all my heart I hope so," responded Mr. Loveday;
"meanwhile, until the better fortune smiles upon us, we must work
all the harder, and bring our best courage to bear upon the present."
Their conversation was interrupted by a gentle tapping at the
door, and, opening it, they saw Timothy Chance, who had a covered
basket on his arm which he laid upon the floor, and then respectfully
greeted Mr. Loveday and Nansie, who, however, would not be
content with this, but shook hands heartily with him.
A word of explanation as to Timothy's movements will here be
useful.
They had not seen him since within a fortnight of the fire which
had plunged them so low. When he was convinced that there was no
present hope of Mr. Loveday being able to re-establish his business,
he had looked out for a situation in the immediate neighborhood, in
order that he might be near the friends to whom he was so
devotedly attached. But his efforts were not successful; no situation
presented itself which he could accept, and as he was driven by
necessity, which knows no law, he was compelled to avail himself of
an engagement in the country some fifteen miles away, which
offered itself in the nick of time. What eventually transpired will be
best related in his own words.
"You thought I'd forgotten you, sir," he said to Mr. Loveday.
"No, my lad, I did not think that. My thought was that you had
not been fortunate, and that you kept away out of consideration for
us."
"Thank you, sir. You have a happy way of saying things. True, too,
because I was not very fortunate at first; but there has been a turn
in the wheel."
"A good turn, Timothy, I hope?"
"It will prove so, sir, if I have a head upon my shoulders; always
trusting that there are no more fires."
"Ah," said Mr. Loveday, "we have had enough of those
experiences."
"Yes, that we have, sir," responded Timothy, gravely; "but what I
say is, 'Never despair.' I have not neglected my studies, sir, and I can
give you the Latin words if you like--'Nil desperandum.'"
Timothy said this proudly, and with a bright eye.
"Good lad," said Mr. Loveday. "It is not in you to despair, Timothy.
You are the stuff that men are made of, and will run ahead of all of
us."
"Never so far ahead, sir," said Timothy, wistfully, "that I shall lose
sight of the best friends a poor boy ever had; but that sounds like
boastfulness."
"Not at all, Timothy, not at all. You speak with as much modesty
as resolution. This turn in the wheel, my lad--what kind of a turn?"
"I think, sir," said Timothy, with a gay laugh, "that you could
guess in once."
Mr. Loveday glanced at the basket on the floor, and made a guess
in merry mood, for Timothy's blithe spirits were contagious.
"Eggs, Timothy?"
"Yes, sir," said Timothy, laughing again; "you have guessed it in
once--eggs. But before I tell you about it"--he turned to Nansie--
"how is baby?"
"Thriving beautifully, Timothy," replied Nansie.
"May I see her?" he asked.
"Wait a moment," said Nansie, and she went to the inner room,
where baby was lying in her cradle. Returning, she said: "Yes, you
may see her; but you must be very quiet. Do not make the least
noise, and don't be surprised at what you see. My dear husband is
home."
A bright light came into Timothy's face.
"I am glad," he said, "for your sake and baby's."
He stepped softly into the bedroom, accompanied by Nansie, and
stood in silence for a few moments, gazing affectionately at the
sleeping child.
"May I kiss her?" he said.
"Yes, Timothy, but very, very softly."
With the gentleness of a woman he stooped and kissed the child,
and then came back with Nansie to the sitting-room, closing the
door softly behind him.
"Eggs, as you say, sir," he recommenced, taking up the business
part of the conversation where it had broken off. "You know that I
had to sell off my little stock of fowls here, so that I might get to the
situation I heard of. It wasn't a very good one, and it wasn't a very
bad one; I had to work hard, which is a thing I shall never complain
of, and although, besides my grub, I got very little a week, I
managed to save a little out of that. Well, sir, six weeks ago I had
two laying hens, and there I was established again in a small way,
doing business for myself outside the hours I had to work for my
employer. Then came a bit of good-fortune, the turn in the wheel I
spoke of. Not far from my place lives a blacksmith, and to him I've
been going of a night for a little while past, teaching him to write a
bit, teaching him to read a bit, and reading books to him myself that
made him laugh and cry. He gets fond of me and we get talking
together, especially about eggs. Says I, 'There's a fortune in eggs.'
Says he, 'Is there?' Says I, 'No doubt of it.' And three weeks ago--
that is, you know, three weeks after I had set up in business again
with my two fowls--I put it all down in figures one night, and we
went into it seriously. 'It seems all right,' says he. 'It is all right,' says
I. 'Supposing you have not made a mistake,' says he, 'and that you
are not being deceived by sparks.' He was hammering away on his
anvil, and the sparks were flying up. 'Supposing that,' says he, 'and
they are very deceptive creatures--sparks--bright as stars one
moment, dead as ghosts the next, how much would it take to start
the business?' 'First,' says I, 'there's the ground.' 'I've got that,' says
he, 'at the back of the forge; an acre and a half.' 'Then,' says I,
'there's timber for fowl-houses, say enough for thirty to commence
with.' 'I've got that,' says he, 'lying idle on the waste ground behind.'
'And nails you've got,' says I. You see, sir, I was speaking with
confidence, and rather boldly, because a voice was whispering to
me, 'Here's your chance, Timothy.' 'And tools to work nails and
timber with,' says I. 'Labor will cost nothing; I should be carpenter
and builder.' 'Should you?' says he, 'and I could give you a hand. But
an acre and a half of ground and any amount of timber and nails
won't lay eggs. Come to the grip--how much money to bring that
about?' 'Ten pounds will be ample,' says I. 'I've got that,' says he,
'and more at the back of it. Say ten pounds then.' 'Do you mean it?'
says I, my heart almost jumping out of my body. 'I never say what I
don't mean,' says he, 'though I don't always say what I do. It is
agreed, Timothy, that we go into partnership; rent of ground to be
reckoned, nails and tools to be reckoned, timber to be reckoned, and
ten pounds to be reckoned, as the capital of the firm. The sooner
you start, the better.' I think you know enough of me, sir," continued
Timothy, glowing, "to know that I didn't waste an hour. Waste an
hour! I didn't waste a minute; and before that week was over the
fowl-houses were up, not far away from the forge--because warmth,
sir, is a good thing for laying hens--and there was a stock of thirty
black Hamburgs to start with. Now, sir and Mrs. Manners, we have
been in business just one fortnight, and everything is going on
swimmingly. My partner says he never saw such fowls, and says I
deal in magic; but the only thing I deal in, sir, is common-sense. So,
being fairly started on my way, and having something good to tell, I
burned to come and tell it to the friends I honor most; and now I
must go. I have to get back to-night; but perhaps you will let me
come to see you again."
"Indeed, we shall be delighted to see you at any time, Timothy,"
said Nansie, for he looked at her for an answer. "No one is more
rejoiced at your good-fortune, and at the prospect before you, than
ourselves."
"I know that," said Timothy. "Good-night, and God bless you."
"Your basket, Timothy," said Mr. Loveday.
"Oh, if you will excuse me, sir, it is yours, and not mine. I have
brought it for you, and I hope you will not take it amiss." And off
Timothy went, without another word.
Opening the basket when he was gone, they took out a score of
new-laid eggs and a young fowl trussed for roasting. Tears came
into Nansie's eyes.
"Did I not say, uncle," she murmured, "that Providence will
smooth the path before us?"
Mastering AngularJS for NET Developers 1st Edition Majid Mohammad Wadood Mirzaei Golrokh
CHAPTER XXVIII.
The week that followed was one of great anxiety to Nansie,
springing less from the pecuniary circumstances of their position
than from the state of Kingsley's health. The privations and the
sufferings he had endured told upon him now that the excitement of
the reunion with his wife was over, and for some days he was too
weak to leave the house. He himself made light of his sickness, and
would not admit that there was anything seriously the matter with
him. They made no endeavor to impress this upon him, but he
gathered it from the evidences of care and attention by which he
was surrounded.
There was in the neighborhood a doctor of great skill, who could
have practised successfully in fashionable quarters at high fees, but
who had deliberately chosen to remain among the poor, whom he
loved and attended to with as much devotion as he would have
displayed to the highest in the land. His fee was fixed at a shilling;
when this was not forthcoming he was content with sixpence, and in
many cases with nothing, making no complaints against tardy
debtors. This man was always cheerful, ready, and willing, at
whatever hour of the day or night; and, without ostentation, he
played the part of a true minister to those who needed it most. It is
pleasant to be able to limn, even thus briefly, the character of one in
whose life and career were exhibited the noblest attributes of human
nature. He and Mr. Loveday were friends, and shortly after Nansie
came to live with her uncle Dr. Perriera was greatly attracted to her,
no less by her gentle manners than by the display of attainments
superior to those among whom she lived. When Mr. Loveday was
burned out Dr. Perriera was the first to express sympathy with him;
he would also have been the first to offer practical assistance had it
not been that he was very poor, a fact which troubled him not at all
so far as regarded himself, but frequently disturbed him when he
came into contact with distress which it was not in his power to
relieve. After the fire, when he attended Nansie of his own free will
and prompting, he declined to receive any fee whatever, and to this
Mr. Loveday did not demur.
As his name indicated, Dr. Perriera was of Spanish descent, and
could, indeed, trace his genealogical record back to the days when
Spain was first among the nations of the world in art, literature, and
science. But the dark and heavy hand of bigotry effectually scotched
the fair promise which lay before the favored nation, and with the
exodus of the Jews--to which race Dr. Perriera belonged--
commenced the decay of a mighty nation.
On the day succeeding that of Kingsley's return Mr. Loveday called
upon Dr. Perriera, and told him of it.
"I am greatly pleased," said Dr. Perriera; "it will be better
medicine for Mrs. Manners than the finest drugs in the
Pharmacopœia."
Then, in order that Dr. Perriera might be in possession of all
necessary information, Mr. Loveday made him acquainted with the
particulars of Kingsley's association with Mr. Seymour, following
those up with the intelligence of the strange hallucination under
which Kingsley was laboring with respect to his long absence from
home. To Mr. Loveday's surprise, Dr. Perriera showed an intimate
knowledge of the movements of the so-called Mr. Seymour, as well
as of the secret societies in the interests of which it was said that he
travelled.
"Of Mr. Manners," said Dr. Perriera, "I know nothing. In Mr.
Seymour's transactions he was little better than a cipher, and was
probably used as an innocent decoy, or as a means to avert
suspicion from the doings of his chief."
"How have you become acquainted with these affairs," asked Mr.
Loveday; "you, who seem to have no spare moments of time apart
from your professional offices?"
"I have time and to spare for much," replied Dr. Perriera, smiling.
"I keep up rather an extensive correspondence with many European
societies which have for their object the advancement of science and
humanity."
"Humanity!" exclaimed Mr. Loveday.
"I call it by that name," said Dr. Perriera. "Were it possible that
the ends aimed at could be reached, the toilers of the world would
be undoubtedly benefited. The advocated means are frequently
pernicious and indefensible; but this occasionally arises from the fact
that men of keen intellectual power are goaded to madness by the
tyranny of old systems. However, enough of this; I think much but
speak little of such matters. I have my small part to play in the world
as to the larger and grander movements of which I can simply look
on and observe."
Dr. Perriera called to see Kingsley, and of his own accord visited
him daily. He gave Nansie kindly hope and sympathy, but did not
enter into the peculiarities of her husband's case. With Mr. Loveday
he was more open.
"It is a singular condition," he said. "The loss of memory is not at
all uncommon, nor, either, is its recovery; but in most instances this
loss is a total loss, time, well-known incidents, relative
circumstances, the names of friends and acquaintances, even one's
own name, being plunged for a period into absolute obscurity. But
here the loss of memory is partial, and the singular phase of it is
that it affects only those circumstances of the past which it would be
disagreeable to recall. He remembers all that is pleasant and happy
in his life, but forgets all that has brought trouble upon him. It
belongs to this phase that he is incapable of realizing the privations
of the life which seems to lie before him. His temperament is
exceptionally bright and cheerful; he looks upon the happy side of
nature, and every hopeful sentiment which passes his lips seems to
blossom into flower at the moment of its utterance. I can imagine no
happier condition of being; but in a poor man it has its grave and
most serious side."
"How?" inquired Mr. Loveday.
"In the fact," replied Dr. Perriera, "that it allows no room for
effort, that it affords no incentive to it, that it creates a sure
contentment even for a crust of bread, and an utter obliviousness to
what may be necessary for those who, he being the head of the
family, are naturally dependent upon him."
"That is to say," observed Mr. Loveday, "that there is no hope of
his being the bread-winner."
"None," said Dr. Perriera, "until there is a radical change in him;
and I confess to being at a loss as to how this can be effected."
The correctness of the good doctor's diagnosis was verified by an
incident which did not come to the ears of Nansie or her uncle until
after its occurrence. Stronger in body, and able to walk abroad
without assistance, Kingsley soon made himself acquainted with all
the intricacies of the neighborhood; and on a certain morning he
wended his steps to the West-end of the city, and stood before his
father's house. Without hesitation he knocked and rang, and upon
the door being opened pushed his way past the astonished servant,
and walked straight to his father's study. There sat Mr. Manners, who
gazed at his son with sternness and some inward agitation which he
was successful in concealing.
"Good-morning, father," said Kingsley, drawing a chair to the
table, and seating himself; then glancing at the papers scattered
about, added, in a tone of inquiry, "Fresh contracts?"
Mr. Manners did not reply to the question.
"What brings you here?" he asked.
Kingsley had grown thinner since he last saw him, and that
circumstance and the shabbiness of Kingsley's appearance suddenly
inspired in the heart of Mr. Manners the hope that his son had come
to him in submission.
"I was anxious about you, father," said Kingsley, in an affectionate
tone, "it seems so long since we saw each other. A son must not be
forgetful of his duties."
"Ah," said Mr. Manners, his hope growing, "you recognize that at
last?"
"At last!" said Kingsley, in a tone of cheerful surprise. "I have
always recognized it. I cannot recall that I have ever been wanting
in my duty to you."
Mr. Manners stared at his son, debating now within himself what
kind of part Kingsley had come to play. There was a silence of a few
moments, during which Kingsley gazed at the familiar objects of the
room with great calmness, and quite at his ease.
"The object of your visit?" demanded Mr. Manners.
"I have told you, father. Are you well?"
"Yes, I am well."
"And happy?"
"Yes," replied Mr. Manners, setting his teeth, "and happy. That
knowledge will hurt you, perhaps."
"Why, no, father, it delights me. Everything, as usual, prospers
with you, of course."
"Everything, as usual, prospers with me," said Mr. Manners,
mechanically. "Did you inquire of the servant if I was at home?"
"No, why should I? It was my home once as well as yours."
"But is no longer," said Mr. Manners, with a deepening frown.
"Oh, well, no, in a certain sense," said Kingsley, "not directly, but
indirectly still my home as well as yours. There are ties which can
never be broken, and which you, in the goodness of your heart,
would never wish to be broken. I should not like to hear from any
man's lips that you think otherwise; I am afraid I should say
something unpleasant to him."
Kingsley's cordial manner and cheerful voice would have mystified
most men with a weaker order of mind than Mr. Manners's; but
although this was not the case with the great contractor, he was
certainly at a loss to account for them. He knew that Kingsley
possessed a soul of frankness and honesty, and he could not readily
bring himself to believe that it was cunning and duplicity which had
induced his son to seek this interview. Still, for the exhibition of
these qualities he would have been, as he always was with all men,
perfectly prepared, but not for the ingenuousness with which he was
now confronted. He thought to turn the tables upon Kingsley.
"Are you well?" he asked.
"Quite well, father," replied Kingsley.
"And happy?"
"Quite happy, father."
"And prosperous?"
"To be quite well and happy," said Kingsley, in no spirit of evasion,
"is not that a prosperous state?"
"You are quibbling with me," said Mr. Manners, "and I am not in
the mood, and have no time for trifling."
"I shall not detain you long, father; you have eased my mind, and
I shall go away presently, quite contented. As to quibbling, you, who
know me so well and have been so good to me, must know that I
am incapable of such conduct."
"I decline to argue with you. Come to the point at once. You wish
to make some kind of appeal to me. I did hope that you had come in
submission."
"I have, father; submission in all things that accord with one's
duty."
"With your duty to me?"
"To you and to others who are dear to me."
"I will not listen," said Mr. Manners, "to anything concerning
them."
"I will not force it upon you. There shall be nothing discordant
between us. But what do you mean by 'appeal?'"
"You are here to ask for money, as those who have separated us
have been here before you."
"Indeed, you are quite wrong. There has been, there shall be, no
separation between us. I love you as I have always done, as I
always shall love you. And they appealed to you for money! Did you
give it to them?"
"No, nor will I to you."
"Oh, but I need none. You have been since my earliest
remembrance most liberal to me, but you cannot accuse me of being
mercenary. I should like you to know my wife, I should like you to
know and love our child. If you are too busy for that now, we will
wait; when you visit us, which surely you will do some day, you will
be pleased at the manner in which we shall receive you; all the
honor that is due to you shall be cheerfully rendered."
"This mockery must end," said Mr. Manners; "go! But, before you
leave, it will, perhaps, be as well for me to say what is in my mind."
"Yes, father," said Kingsley, gently.
"I do not know," said Mr. Manners, in a set, hard tone, "whether I
should ever have been inclined to forgive your disobedience and
undutifulness; I do not know, after what has passed, whether, you
being my son upon whom once all my hopes were centred, I should
have been disposed to once more hold out my hand to you. I think it
would not have been possible, but there may have been, at least,
some remote chance of a partial reconciliation. If there was such a
chance, you have utterly destroyed it by your conduct during the
past few months."
"What conduct do you refer to?" asked Kingsley, smiling. "You
surely are laboring under some delusion!"
"It is no delusion," said Mr. Manners, "that you have been
travelling for some time with a person of infamous character and
designs!"
"Surely it must be, father. Does the man live? If he does, he will
disprove it."
"I will fall in with your humor," said Mr. Manners, "and will pay no
attention to your amazing evasions; all the more amazing, all the
more inexcusable, when adopted towards a man like myself. Do you
pretend that you are unacquainted with the person who travelled
under the name of Seymour? Do you pretend that travelling in close
association with him as you did for so long a time, you had no
connection with the designs he was wishful to promote?"
"You remind me strangely," replied Kingsley, "of something which
has been troubling me--no, I am wrong in saying troubling me, I
mean that has been interesting me. There have undoubtedly been
some such designs as you refer to, mysterious and inexplicable
enough to me, but the interesting part of the matter is, how did it
ever come into my mind that I could have been associated with
them? Clearly, I must have evolved the idea out of a too vivid
imagination; because I cannot trace the slightest actual connection
between me and them. Similarly, too, with the name you have
mentioned--Seymour. How did it come into my mind that I knew
such a gentleman? Clearly, he must have existed; and now there
occurs to me a dim remembrance of a railway accident in which a
gentleman of the name of Seymour was killed, and many were
injured. How comes the knowledge of that circumstance to me? May
I not also have evolved that from my imagination? Anyway, I shall
not allow myself to be troubled by matters which I cannot directly
trace, though I cannot avoid being interested in them. But what you
have said has another bearing, as though I had done something to
disgrace my name. Of course such a thing would be impossible, and
if I am indebted to any ill-natured person for having aroused in you
any suspicion to my hurt, I make him my hearty acknowledgments
without bearing the slightest ill-will against him, because, after all,
father, a serious calumny should not be allowed to have weight
unless an absolute foundation of fact can be brought forward, as
cannot be done in my case. Man must be judged by his own actions,
not by what people say of him. You infer that this Mr. Seymour
travelled to promote infamous designs with which you suppose me
to be in sympathy. What designs, father?"
"Republicanism," said Mr. Manners, not displeased at being
brought to the point, "Socialism, Communism, and the overthrow of
existing institutions, which are a blessing to mankind."
"Ah, but there, you know," said Kingsley, with no departure from
his light mood, "you open up debatable matter. It is not disagreeable
to me. I was always fond of argument, although I have been
accused of too freely wandering away from one upon the slightest
excuse. You condemn Republicanism, but I think I would sooner live
under a republic than a monarchy."
"What you say confirms the accusation I and others bring against
you."
"Not at all. I am merely expressing my view of a large matter. You
see, father, there is so much misery in the world, so much
undeserved suffering, so much compulsory poverty, such astounding
inequalities in the social condition of the people, that a fair-minded
man cannot possibly avoid wishing to remedy these ills. What are
you touching the bell for?"
"For the servant to show you to the door."
"I do not need him; I know my way out. Your time is valuable,
and it is inconsiderate of me to take up so much of it. Is my mother
in?"
"No."
"I am sorry; I wished to see her. She is well, I hope."
"Quite well. She has not a sorrow in the world. And now, for the
last time, leave the room--and the house."
His peremptory, harsh tone had no effect upon Kingsley, who,
with a genial nod and a "Good-morning, father," left the house with
a light step.
In the evening he informed Nansie and Mr. Loveday of his visit to
his father, and, to their astonishment, described it as one of a
pleasant character. Their astonishment was all the greater when they
read a letter which was delivered personally to Kingsley. It was from
a firm of lawyers, and was written in accordance with instructions
received from Mr. Manners. In the first place it conveyed an
intimation that Kingsley would not be allowed again to enter his
father's house; in the second place it contained a warning that if he
made any further endeavor to force himself into his father's
presence, proceedings would be taken against him for the trespass.
"I think," said Kingsley, "that lawyers must have been invented
expressly to torment mankind; they never can put a thing pleasantly.
My father, I suppose, is too busy to write to me himself, so he told
his lawyers to do so, and they, wishing to make things as unpleasant
as possible, send me a communication couched in terms which my
father would certainly resent. Of course I shall not go to him again
until he sends for me."
So saying, he tore up the letter and put it into the fire.
A few days afterwards it was announced in the papers that Mr.
Manners had broken up his London establishment, and with his wife
and his nephew, Mr. Mark Inglefield, had started on a foreign tour,
which was likely to be of long duration. This paragraph was read by
Kingsley, and caused in him the first spark of resentment he had
exhibited since his return.
"I am sorry," he said, "that my father has taken up with such a
man as Mark Inglefield. He is dangerous and coldblooded, and, I am
afraid, no friend of mine. Not that I want him for a friend, but that,
being with my father, he may say something against us. However, to
use your dear mother's saying, Nansie, 'Everything will come right in
the end.'"
With this comfortable assurance he dismissed the matter from his
mind, as was his habit.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!
textbookfull.com

More Related Content

PDF
Building Productionready Web Apps With Nodejs A Practitioners Approach To Pro...
PDF
Java Data Access Jdbc Jndi And Jaxp Thomas Tm
PDF
ASP.NET 8 Best Practices 1 / converted Edition Jonathan R. Danylko
PDF
Multiple User Interfaces Crossplatform Applications And Contextaware Interfac...
PDF
Mastering ASP NET with Visual C 1st Edition A. Russell Jones
PDF
Advanced Systems Design with Java UML and MDA 1st Edition Kevin Lano
KEY
What ya gonna do?
 
PDF
Mastering ASP NET with Visual C 1st Edition A. Russell Jones
Building Productionready Web Apps With Nodejs A Practitioners Approach To Pro...
Java Data Access Jdbc Jndi And Jaxp Thomas Tm
ASP.NET 8 Best Practices 1 / converted Edition Jonathan R. Danylko
Multiple User Interfaces Crossplatform Applications And Contextaware Interfac...
Mastering ASP NET with Visual C 1st Edition A. Russell Jones
Advanced Systems Design with Java UML and MDA 1st Edition Kevin Lano
What ya gonna do?
 
Mastering ASP NET with Visual C 1st Edition A. Russell Jones

Similar to Mastering AngularJS for NET Developers 1st Edition Majid Mohammad Wadood Mirzaei Golrokh (20)

PDF
Clean Architecture With Net For True Epub Dino Esposito
PDF
Advanced Systems Design with Java UML and MDA 1st Edition Kevin Lano
PDF
Rich User Experience by Calibra
PDF
JavaScript Design Patterns Hugo Di Francesco
PDF
Secure Java For Web Application Development
DOCX
ffirs.indd iffirs.indd i 280712 610 PM280712
PDF
Advanced Systems Design with Java UML and MDA 1st Edition Kevin Lano
PDF
Handson Cloud Analytics With Microsoft Azure Stack Prashila Naik
PDF
Encyclopedia of Networked and Virtual Organizations Goran Putnik
PDF
Designing Data Intensive Web Applications 1st Edition Stefano Ceri
DOCX
Top Strategic Technology Trends for 2022.docx
PDF
JavaScript Design Patterns Hugo Di Francesco
PDF
Building an API Product: Design, implement, and release API products that mee...
PDF
Infinitytech New
PDF
What do you need to know before going in to Sri Lankan IT industry
PDF
Big Data Analytics With R And Hadoop Vignesh Prajapati
PDF
JavaFX 1 2 Application Development Cookbook 1st Edition Vladimir Vivien
PDF
Service Oriented Architecture With Java Using Soa And Web Services To Build P...
PDF
Designing Data Intensive Web Applications 1st Edition Stefano Ceri
PDF
2020 Top Web Development Trends
Clean Architecture With Net For True Epub Dino Esposito
Advanced Systems Design with Java UML and MDA 1st Edition Kevin Lano
Rich User Experience by Calibra
JavaScript Design Patterns Hugo Di Francesco
Secure Java For Web Application Development
ffirs.indd iffirs.indd i 280712 610 PM280712
Advanced Systems Design with Java UML and MDA 1st Edition Kevin Lano
Handson Cloud Analytics With Microsoft Azure Stack Prashila Naik
Encyclopedia of Networked and Virtual Organizations Goran Putnik
Designing Data Intensive Web Applications 1st Edition Stefano Ceri
Top Strategic Technology Trends for 2022.docx
JavaScript Design Patterns Hugo Di Francesco
Building an API Product: Design, implement, and release API products that mee...
Infinitytech New
What do you need to know before going in to Sri Lankan IT industry
Big Data Analytics With R And Hadoop Vignesh Prajapati
JavaFX 1 2 Application Development Cookbook 1st Edition Vladimir Vivien
Service Oriented Architecture With Java Using Soa And Web Services To Build P...
Designing Data Intensive Web Applications 1st Edition Stefano Ceri
2020 Top Web Development Trends
Ad

Recently uploaded (20)

PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
RMMM.pdf make it easy to upload and study
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
Presentation on HIE in infants and its manifestations
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
Cell Structure & Organelles in detailed.
PPTX
Lesson notes of climatology university.
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
01-Introduction-to-Information-Management.pdf
O7-L3 Supply Chain Operations - ICLT Program
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Supply Chain Operations Speaking Notes -ICLT Program
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
RMMM.pdf make it easy to upload and study
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Presentation on HIE in infants and its manifestations
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Cell Structure & Organelles in detailed.
Lesson notes of climatology university.
Abdominal Access Techniques with Prof. Dr. R K Mishra
Microbial diseases, their pathogenesis and prophylaxis
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
FourierSeries-QuestionsWithAnswers(Part-A).pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
2.FourierTransform-ShortQuestionswithAnswers.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
102 student loan defaulters named and shamed – Is someone you know on the list?
01-Introduction-to-Information-Management.pdf
Ad

Mastering AngularJS for NET Developers 1st Edition Majid Mohammad Wadood Mirzaei Golrokh

  • 1. Mastering AngularJS for NET Developers 1st Edition Majid Mohammad Wadood Mirzaei Golrokh pdf download https://textbookfull.com/product/mastering-angularjs-for-net- developers-1st-edition-majid-mohammad-wadood-mirzaei-golrokh/ Download more ebook from https://textbookfull.com
  • 2. We believe these products will be a great fit for you. Click the link to download now, or visit textbookfull.com to discover even more! Mastering Corda Blockchain for Java Developers 1st Edition Jamiel Sheikh https://textbookfull.com/product/mastering-corda-blockchain-for- java-developers-1st-edition-jamiel-sheikh/ Full Stack AngularJS for Java Developers: Build a Full- Featured Web Application from Scratch Using AngularJS with Spring RESTful 1st Edition Ravi Kant Soni (Auth.) https://textbookfull.com/product/full-stack-angularjs-for-java- developers-build-a-full-featured-web-application-from-scratch- using-angularjs-with-spring-restful-1st-edition-ravi-kant-soni- auth/ The Art of Coding: The Language of Drawing, Graphics, and Animation Mohammad Majid Al-Rifaie https://textbookfull.com/product/the-art-of-coding-the-language- of-drawing-graphics-and-animation-mohammad-majid-al-rifaie/ M M Essential Anatomy 4th Edition Majid Alimohammadi And Majid Doroudi https://textbookfull.com/product/m-m-essential-anatomy-4th- edition-majid-alimohammadi-and-majid-doroudi/
  • 3. Kubernetes for Developers 1st Edition William Denniss https://textbookfull.com/product/kubernetes-for-developers-1st- edition-william-denniss/ Beginning AngularJS Grant Andrew https://textbookfull.com/product/beginning-angularjs-grant- andrew/ AngularJS Directives Vanston Alex https://textbookfull.com/product/angularjs-directives-vanston- alex/ Dependency Injection with AngularJS 1st Edition Knol Alex https://textbookfull.com/product/dependency-injection-with- angularjs-1st-edition-knol-alex/ Cellulose Nanocrystals: Properties, Production and Applications 1st Edition Wadood Y. Hamad https://textbookfull.com/product/cellulose-nanocrystals- properties-production-and-applications-1st-edition-wadood-y- hamad/
  • 5. Mastering AngularJS for .NET Developers Master the art of developing applications using AngularJS, ASP.NET Web API 2, and Visual Studio 2013 Mohammad Wadood Majid Golrokh Mirzaei BIRMINGHAM - MUMBAI
  • 6. Mastering AngularJS for .NET Developers Copyright © 2015 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: April 2015 Production reference: 1230415 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78355-398-3 www.packtpub.com
  • 7. Credits Authors Mohammad Wadood Majid Golrokh Mirzaei Reviewers Abhishek Dey Davide Guida Weiqing Sun Commissioning Editor Ashwin Nair Acquisition Editor Usha Iyer Content Development Editor Natasha Dsouza Technical Editor Mrunmayee Patil Copy Editors Sonia Michelle Cheema Neha Vyas Project Coordinator Rashi Khivansara Proofreaders Safis Editing Paul Hindle Indexer Mariammal Chettiyar Graphics Sheetal Aute Production Coordinator Manu Joseph Cover Work Manu Joseph
  • 8. About the Authors Mohammad Wadood Majid has been working in the field of application development and design for more than a decade for some major companies in the USA. During this time, he has worked independently as well as with teams to develop a number of highly successful enterprise applications for the Web and mobiles. He is experienced in the development, designing, testing, modification, and maintenance of enterprise applications. Currently, he is working as an enterprise application administrator and developer and a part-time assistant professor at the University of Toledo. He has worked extensively with MVC, web APIs, ASP.NET, ADO.NET, C#, OData, and RESTful. He has expertise in native mobile apps and web-based application development that can be performed using HTML5, JavaScript, jQuery, Bootstrap, AngularJS, and CSS. He has experience of working with databases such as SQL Server 2012 and Oracle 11g. He has also performed research on the following topics: • Parallel implementation of algorithms on multicore and NVIDIA's GPU • Parallel computation of moving target detection and recognition from a set of radar signals • Development of parallel programs using multicore and NVIDIA's GPU for artificial intelligent algorithms, such as evolutionary neural networks and genetic algorithms I would like to dedicate this book to my parents for their support and encouragement in all my endeavors. Especially, I would like to thank my sister, Rabia, and her husband, Zafar, for their patronage.
  • 9. Golrokh Mirzaei has several years of software development experience in the software industry and is currently working as a faculty at the Ohio State University. His research involves the development of software applications and multisensor data fusion approach to monitor biological targets using three different sensors: infrared camera (IR), radar, and acoustics. The infrared camera and radar sensors involve video and image processing techniques, including object detection and recognition, feature extraction, classification/clustering, and tracking. He has published several papers at professional IEEE conferences and received several awards. His developments in the field of image processing and computer vision are unique, related to multifidelity, and multidisciplinary. He has also performed research on the following topics: • Pattern recognition (object detection, feature extraction, tracking, and so on) • Machine learning (supervised/unsupervised learning) • Classification/clustering • Image/video/audio processing (infrared camera, radar, and acoustics) • Bio-inspired computing (ACA, ACO, and GA) • Bayesian inference and fuzzy reasoning I would like to thank the Department of Information Technology at the University of Toledo for giving me the opportunity to implement the techniques described in this book in a real project, called the Patient Handoff Tool.
  • 10. About the Reviewers Abhishek Dey, born in West Bengal, India, is a graduate student at University of Florida, Gainesville, where he is conducting research in the fields of algorithms, data structures, data mining, compiler design, computer security, and concurrency and parallelism. He is a passionate programmer who started programming in C and Java at the age of 10, and soon afterwards, developed a strong interest in web technologies and system implementations. He possesses profound expertise in developing high volume software using C#, C++, Java, JavaScript, jQuery, AngularJS, and HTML5. He is a Microsoft Certified Professional, an Oracle Certified Java Programmer, Oracle Certified Web Component Developer, and Oracle Certified Business Component Developer. He has also contributed toward bringing new innovations in the field of Highway Capacity Software Development at McTrans Center of University of Florida (http://mctrans.ce.ufl.edu/mct/), which works in collaboration with Engineering School of Sustainable Infrastructure and Environment (http://www. essie.ufl.edu/). In his leisure time, Abhishek loves listening to music, travelling to different, interesting places, or painting on canvas, giving colors to his imagination. More information about Abhishek Dey can be found at http://abhishekdey.com. The best way to contact him is through his e-mail, contact.dey2015@yahoo.com. Abhishek has reviewed Kali Linux CTF Blueprints and AngularJS UI Development, both by Packt Publishing. I'd like to thank my grandmother Aparna Dey, my aunties Mousumi Dey and Mithu Mondal, and my great grandfather the late Sambhu Nath Dey, for all the love and affection they have always showered on me.
  • 11. Davide Guida is a technical architect and technical delivery manager at Razorfish Healthware (http://www.razorfishhealthware.com) in Salerno, Italy. He works mostly with .NET and SQL projects and deals with the analysis and development of complex client/server applications, remote services, and multimedia solutions. He is also the lead architect and developer at Videum (http://www.videum.com). He started programming at age of 5 when his mother, a math teacher, began teaching him BASIC and Clipper on their Intel 286. He has a strong programming background in C#, C++, JavaScript, SQL, and MongoDB. More information about Davide can be found at http://davideguida.altervista.org. Thank you mom for showing me the way and thank you Nadia for pushing me to do my best. Weiqing Sun is an associate professor of the computer science and engineering technology program at the University of Toledo College of Engineering. He obtained his PhD degree from the Computer Science Department of Stony Brook University (SUNY Stony Brook) in 2008. He holds a BE and an ME degree in computer science and engineering from Tongji University, Shanghai, China. Dr. Sun's primary research interests lie in the areas of computer and network security (in particular, malware defense and detection, security policy development, intrusion detection, and security issues with unmanned aerial vehicles), cloud computing, healthcare information systems, transportation information systems, and smart grids. In these areas, he has published over 40 peer-reviewed papers and is currently advising a number of MS and PhD students.
  • 12. www.PacktPub.com Support files, eBooks, discount offers, and more For support files and downloads related to your book, please visit www.PacktPub.com. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub. com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. TM https://www2.packtpub.com/books/subscription/packtlib Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books. Why subscribe? • Fully searchable across every book published by Packt • Copy and paste, print, and bookmark content • On demand and accessible via a web browser Free access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.
  • 13. [ i ] Table of Contents Preface v Chapter 1: Introduction 1 Understanding the need for client-side development 1 Client-side data binding libraries 3 Understanding AngularJS 4 What is AngularJS? 4 Why AngularJS? 5 Getting acquainted with the anatomy of AngularJS 10 Model 12 View 12 Controller 13 The AngularJS design pattern 13 Notable built-in directives 19 AngularJS – the conceptual overview 20 Templates 21 Directives 21 Filters 22 Services 23 Dependency Injection 25 The compiler 25 The overview of a single-page application 26 Benefits of SPAs 27 Summary 27
  • 14. Table of Contents [ ii ] Chapter 2: Learning AngularJS Binding and Directives 29 Data binding 30 One-way binding 31 Two-way binding 31 Data binding in AngularJS 32 One-way data binding in AngularJS 33 Two-way data binding in AngularJS 34 Understanding directives 35 The first directive 37 The jQuery perspective 38 Basic behavior 40 The restrict property 40 The template and templateUrl properties 41 The scope property 42 Directive-to-directive communication 51 Summary 53 Chapter 3: AngularJS Scopes, Controllers, and Filters 55 Understanding the scope of AngularJS 55 AngularJS scope's chain of command 57 The AngularJS scope lifecycle 59 Adding behavior to the AngularJS scope 62 Understanding controllers 64 Controller inheritance 67 The AngularJS dot representation 69 Controller without scope 71 Understanding filters 72 The custom filter 73 Using a filter in a controller 75 Summary 77 Chapter 4: Communicating with the Server Using AngularJS 79 Communicating with the server using $http 80 Retrieving data with $http using GET 81 Configuring the $http request 84 Caching $http 88 Transforming request and response 90 Communicating with the server using RESTful services and $resource 92 Authentication 95 Authentication with username and password 97 Securing applications 100 Summary 101
  • 15. Table of Contents [ iii ] Chapter 5: Creating Applications Using AngularJS, Entity Framework, and ASP.NET Web API 103 Using Entity Framework 103 Entity Data Model 106 Mapping 106 Entities 107 Relationships 107 Querying data 108 Creating a data model from an existing database 109 A web API 116 Why a web API? 116 Different API types 117 Web service APIs 117 Library-based APIs 118 Class-based APIs 118 Object-remoting APIs 118 Hardware APIs 118 Creating a web API using Visual Studio 118 LINQ 122 Using AngularJS with ASP.NET Web API 123 Summary 129 Chapter 6: Using AngularJS and ASP.NET Web API for CRUD Operations 131 Web API routing 132 Routing with an action name 135 The ASP.NET Web API attribute routing 137 CRUD operation using $http 138 Using $http with the AngularJS factory 141 CRUD operations using $resource 145 The difference between $http and $resource 149 Securing the ASP.NET Web API 149 Summary 157 Chapter 7: Troubleshooting and Best Practices 159 Troubleshooting libraries and tools 159 Unit testing 161 What and what not to test 162 Unit testing using AngularJS 163 Module 163 Controller 164 Directive 166 Unit testing using Jasmine 168 Unit testing using Karma 170
  • 16. Table of Contents [ iv ] AngularJS coding best practices 171 Organizing code 172 Piles 172 Drawer 172 Modularity 173 Common code 174 Using AngularJS 174 Summary 175 Appendix: Angular 2.0 177 Why Angular 2.0 177 Design and features of AngularJS 2.0 178 AtScript 179 Routing solution 179 Dependency Injection 180 Annotations 180 The instance scope 181 The child injector 181 Data binding and templating 181 Dynamic loading 181 Directives 182 Templates 183 Summary 185 Index 187
  • 17. [ v ] Preface Application development is a broad term; it can range from developing the simplest static page of plain text to the most complex database-driven, electronic business, and social networking applications. A more comprehensive list of tasks that application development commonly refers to may include, web designing, content development, client relationships, client-side and server-side configurations, and deployments. In the past, most developers developed server-side applications because of an available server-side framework called Windows Presentation Foundation (WPF) or web frameworks such as ASP.NET or Silverlight. These are used to create objects containing data and bind them to user interface controls such as HTML. However, improved browser features, faster JavaScript engines, and an increase in the usage of mobile devices, such as iPads, iPhones, and Android tablets have definitely shifted the trend from server-side to client-side development. However, data binding has been difficult to implement into client-side application development because neither HTML nor JavaScript natively support it. It is possible to start client-side data binding from scratch; but, it is definitely challenging and possibly not the best solution available. It is also very difficult to maintain and reuse the code. To create a client-side application is an amazing ability, although, the complexity involved in creating it is high. To develop a client-side application involves manipulating the Document Object Model (DOM) in a browser running JavaScript. One of the benefits of client-side applications is that HTML (DOM) will be updated with the click of a button, rather than keeping a user waiting for the server to respond. In the case of server-side rendering, it is very difficult to update the portion of the page. Any portion of a page that's animated or highly interactive (such as a draggable slider, sortable table, or a drop-down menu) almost certainly uses client-side rendering.
  • 18. Preface [ vi ] For the last several years, the application development landscape has changed drastically because of an increase in the use of mobile devices, such as smartphones and tablets. In 2013, mobile web traffic had increased substantially to almost a third of the total web traffic; and it's expected is to increase in the near future. Applications are expected to be able to work on different platforms, such as Windows, web, and mobiles. In order to create multiplatform applications; an application should be enabled to support diverse client browsers and plugins, such as Java and Adobe Flash. The application becomes problematic if the plugins are not available or aren't supported on all devices. Client-side application development environments enable developers to slowly and gradually replace applications, which are based on browser plugins with newer versions of HTML, CSS, and JavaScript. While previous development tools would abstract away the key elements of HTML, CSS, and JavaScript, client-side development developed all these tools. Using client-side development, a programmer can now render and manipulate content by focusing on client-browser capabilities. Several client-side application development approaches, such as responsive page design and progressive development are adopted to build modern web applications that include single-page applications. The development process of these type of applications is, however, challenging and costly when compared to other applications, because they need rapid prototyping, rich client features, and a large JavaScript base to be employed. Another JavaScript framework that has been developed in the same time frame is the AngularJS framework by Google. There are many libraries that have been introduced, such as QUnit in 2008, Jasmine in 2010, and Backbone and Knockout.js in 2010. These libraries address challenges that involve solving client-rich features. They use derivatives involved in a design pattern, such as Model-View-Controller (MVC), which is common in both server and client-sides. During the design, application data and business logic need to be clearly differentiated. This differentiation is achievable by MVC patterns, and the controller components sit in the middle. The controller has access to all the different elements of the application, thus passing the data to and from the model, updating the view, or responding to view changes that are passed to the model. There are several advantages of using an MVC design pattern; these include reusing code in a better manner (the same model can be used for multiple views), testability (the controller can be tested from a view), and efficient development workflows that are achieved due to the designer's ability to modify the view. AngularJS can enhance and extend HTML by adding new elements to it and it is based on the MVC pattern. It can also be tested from the start using modular, composable code units. AngularJS has only grown in popularity since its introduction in 2012.
  • 19. Preface [ vii ] What this book covers Chapter 1, Introduction, acquaints you to understanding the need for client-side development and also to AngularJS. You will also get acquainted with the anatomy of AngularJS and its conceptual overview. Finally, we will discuss the basics of a single page application development process. Chapter 2, Learning AngularJS Binding and Directives, focuses on showing you how the AngularJS data binding works. You will also learn about the use and development of AngularJS directives through code examples. Chapter 3, AngularJS Scopes, Controllers, and Filters, the goal of this chapter is to understand AngularJS scope as well as the controller and its use in AngularJS. We will also cover the built-in filters of AngularJS and show you how to develop a custom filter. Chapter 4, Communicating with the Server Using AngularJS, focuses on how AngularJS communicates with server-side code, such as web API, web services, or Data Access Layer (DAL). In this chapter, we will discuss how to retrieve data from the server using $http and $resources. This chapter also talks about the authentication and security used for a AngularJS application. Chapter 5, Creating Applications Using AngularJS, Entity Framework, and ASP.NET Web API, focuses on how to connect to a database using Entity Framework. In this chapter, we will discuss how to create a web API using ASP.Net and how to consume through AngularJS. Chapter 6, Using AngularJS and ASP.NET Web API for CRUD Operations, will start with web API routing and then focus on how to Create, Read, Update, and Delete records from a database using the ASP. Net web API and the AngularJS $http and $resource directives. We will also discuss the difference between $http and $resource. At the end of this chapter, we will talk about how to secure the ASP.Net web API. Chapter 7, Troubleshooting and Best Practices, focuses on troubleshooting libraries and tools for AngularJS. In this chapter, we will also discuss how to perform unit testing of the Angular JS application using Jasmine and Karma. At the end of chapter, we will go through the AngularJS coding best practices. Appendix, Angular 2.0, introduces us to the Angular 2.0 framework. It may not be a major update to the previous version, but is a complete rewrite of the entire framework and includes significant changes. Here, we also talked about certain Angular 2.0 changes. Angular 2.0 will hopefully be released at the end of 2015.
  • 20. Preface [ viii ] What you need for this book The minimum software requirement is Visual Studio Community 2013 or Visual Studio 2013 Express web, which can be downloaded from https://www. visualstudio.com/en-us/products/visual-studio-express-vs.aspx. We recommend that you use Visual Studio 2013 Professional. Who this book is for This book is targeted at .NET developers who have basic experience in developing web applications and have a fundamental knowledge of HTML, JavaScript, and CSS. Conventions In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning. Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The broadcast() perform can send a message to all or any child controllers, whereas the emit() perform can send a message to all or any ancestors." A block of code is set as follows: <myticker></myticker> <!--<!--<!-- <!--custom attributes - -> <div data-myticker</div> <!--<!--<!-- <!--customer class names - -> <div class="myticker"></div> <!--<!--<!-- <!--used like regular HTML elements - -> New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "As the page is loaded and we move our mouse over the Select car color element, the jQuery dialog box shows the My favorite color is message." Warnings or important notes appear in a box like this.
  • 21. Preface [ ix ] Tips and tricks appear like this. Reader feedback Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail feedback@packtpub.com, and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors. Customer support Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase. Downloading the example code You can download the example code files from your account at http://www. packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you. Errata Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/ submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
  • 22. Preface [ x ] To view the previously submitted errata, go to https://www.packtpub.com/books/ content/support and enter the name of the book in the search field. The required information will appear under the Errata section. Piracy Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy. Please contact us at copyright@packtpub.com with a link to the suspected pirated material. We appreciate your help in protecting our authors and our ability to bring you valuable content. Questions If you have a problem with any aspect of this book, you can contact us at questions@packtpub.com, and we will do our best to address the problem.
  • 23. Introduction The goal of this chapter is to understand the need for client-side development and to understand AngularJS. We will also get acquainted with the anatomy of AngularJS and its conceptual overview. Finally, we will discuss the basics of a single-page application development process. This chapter is organized as follows: • Understanding the need for client-side development • Understanding AngularJS • Getting acquainted with the anatomy of AngularJS • The conceptual overview of AngularJS • Learning the basics of a single-page application Understanding the need for client-side development Application development is a broad term; it can range from developing a simple, static page of plain text to developing the most complex database driven electronic businesses and social network applications. A more comprehensive list of tasks, which application development commonly refers to, may include web designing, content development, client relationship, client-side configuration, server-side configuration, and deployment.
  • 24. Introduction [ 2 ] In the past, most developers were developing server-side applications because of the available server-side frameworks. Windows Presentation Foundation (WPF) or web frameworks, such as ASP.NET or Silverlight, are used to create objects that contain data and to bind them to user interface controls, such as HTML. However, improved browser features, faster JavaScript engines, and the increase in the usage of mobile devices, such as iPad, iPhone, and Android devices, have definitely shifted the trend from server-side to client-side development. However, data binding has been difficult in client-side application development because neither HTML nor JavaScript natively supports data-binding. It is possible to achieve client-side data binding from scratch; however, it is definitely challenging and possibly not the best solution available. It is also very difficult to maintain and reuse the code. To create a client-side application is an amazing ability although the complexity involved in creating a client-side application is high. To develop a client-side application means to manipulate the Document Object Model (DOM) in a browser that runs JavaScript. One of the benefits of client-side applications is that HTML (DOM) will be updated with the click of a button, rather than the user waiting for the server to respond. In the case of a server-side rendering, it is very difficult to update the page. Any portion of a page that's animated or highly interactive (a draggable slider, sortable table, drop-down menu) almost certainly uses client-side rendering. For the past several years, the application development landscape has changed drastically because of the increase in the use of mobile devices, such as smartphones and tablets. In 2013, mobile web traffic increased substantially to almost a third of the total web traffic; this web traffic is expected to increase in the near future. Applications are expected to be able to work on different platforms such as Windows, web, and mobile. In order to create multiplatform applications, the application should support the diversity of client browsers and plugins, such as Java and Adobe Flash Player. This is because an application becomes problematic if the plugins are not available or not supported on all devices. A client-side application development environment enables developers to slowly and gradually replace applications based on browser plugins with newer versions of HTML, CSS, and JavaScript applications. While previous development tools would abstract away the key elements of HTML, CSS, and JavaScript, client-side development embraces all these tools. Using client-side development, a programmer can now render and manipulate content by focusing on client-browser capabilities. Several client-side application development approaches, such as responsive page design and progressive development are adopted to build modern web applications that include single-page applications.
  • 25. Chapter 1 [ 3 ] The development process of these types of applications is however challenging and costly when compared to other applications because these applications need rapid prototyping, rich client features, and a large JavaScript base for them to be employed. Another JavaScript framework that has been developed in the same timeframe and is widely used for developing single-page applications is the AngularJS framework by Google. There are many libraries that have been introduced, such as QUnit in 2008, Jasmine in 2010, and Backbone.js and Knockout.js in 2010. These libraries address the challenges that are involved in solving the rich client features. These libraries use derivatives for a design pattern, such as Model-View-Controller (MVC), which is common in both server-side and client-side. During the design, application data and business logic need to be clearly differentiated. This differentiation is achievable by MVC patterns where the controller components sit in the middle. The controller has access to all the different elements of the application; thus, it passes the data to and from the model, updates the view, or responds to view or changes that are passed to the model. There are several advantages of using the MVC design pattern, such as better code reuse (same model can be used for multiple views), testability (controller can be tested from view), and efficient development workflow that is achieved due to the designer's ability to modify the view. AngularJS can enhance and extend HTML by adding new elements to it and AngularJS is based on the MVC pattern. It can also be tested from the start using modular, composable code units. AngularJS has grown in popularity since its introduction in 2012. Client-side data binding libraries The use of client-side data binding is becoming more widespread as more and more developers are writing client-side applications. Most of these libraries follow the MVC or Model-View-ViewModel (MVVM) design pattern and some of these libraries directly integrate with the server framework, such as Knockout.js. The following table illustrates the list of a few client-side data binding libraries that can be used for a client-side application development: Library name Description AngularJS AngularJS uses the MVC and MVVM design pattern. Backbone.js Backbone.js follows the MVC design pattern for data binding and uses key/value binding as well as customer events. Derby Derby provides a framework that runs in the browser and supports data binding and templates.
  • 26. Introduction [ 4 ] Library name Description Ember Ember uses templates that update the DOM automatically as the data changes. jQXB Expression Binder jQXB Expression Binder is a jQuery plugin that supports two-way data binding and it is very lightweight. JsViews JsViews is a data binding framework that binds views through the JsRender template. KnockoutJS KnockoutJS uses the MVVM design pattern and directly integrates with the server framework. Meteor The Meteor framework uses Node.js on server side and supports data-binding on client side. Simpli5 Simpli5 is a JavaScript framework that provides support for two- way data-binding. Nowadays, the cross-platform application development that uses the client-side binding is more popular. Most of the client-side script libraries retrieved from the server using the JavaScript Object Notation (JSON) format and dynamic binding of the HTML elements can be achieved by employing the JSON format. This is because JSON uses multiple client-side libraries and it is an advanced subset of JavaScript itself. JSON is a preferred client-side application format that parses and transmits data using a lightweight framework, making reading and writing of data easier. Understanding AngularJS The popularity of developing client-side applications for mobile devices, such as iPhones, iPads, and Android tablets is a direct result of market penetration and a growing user base for these devices. Moreover, JavaScript, the MVC framework, and other libraries, such as Backbone.js, Node.js, and so on, have been released and adopted in the mainstream programming. In this section, we will discuss what AngularJS is and its importance. What is AngularJS? AngularJS is a client-side JavaScript library, which has been developed based on the MVC design pattern. AngularJS is used for client-side data binding of client-centric applications. It is open source and used by Google Inc. and its Google community. AngularJS assists to create a client-side application that needs HTML, CSS, and JavaScript. AngularJS's JavaScript framework is an effort taken to make both development and testing of application easier.
  • 27. Chapter 1 [ 5 ] AngularJS contains additional custom HTML tags. It submits the directives in those custom HTML tags and binds the HTML elements in client side with a model's data using standard JavaScript. The values of the JavaScript variables can be set or retrieved dynamically with JSON resources. The way AngularJS's data binding and dependency injection works is that it helps to write very less or no code for the client-side binding. AngularJS is a structural framework for dynamic application development. It lets HTML express an application's components very clearly and concisely within the browser. AngularJS proves to be a good candidate to work with the server technology and especially with ASP.NET and Microsoft's MVC. These days, AngularJS is popular because it extends HTML with additional elements to create a template and to enable DOM for one-way or two-way binding. In real applications, in addition to data binding between view and model, executing the business logic depends on servers. AngularJS has a very rich, built-in support to communicate with the server and it also provides a built-in wrapper for communication with RESTful services. Why AngularJS? AngularJS proceeds by minimizing the impedance mismatch between an application's need for constructing a new HTML and document-centric HTML. Thus, as compared to other available libraries, it takes a different approach. Directives are used in AngularJS to convey to the browser how to use a new syntax. Some of the examples of the directives are: • Data-binding, as in {{}} • The two-way binding facility in AngularJS enables automatic change of either the target or source property in case one of them changes • Control structures for repeating and hiding a certain portion of a page • AngularJS sustains the client-side form validation • AngularJS connects the server-side code to DOM elements using JSON • AngularJS provides a way to group HTML to reusable components • AngularJS contains the Hypertext Transfer Protocol service, which can be used to communicate with remote servers
  • 28. Introduction [ 6 ] AngularJS has been developed in the belief that it can be used to solve problems that don't require the developer to specify any extra procedures. The following are the design goals of AngularJS: • To separate DOM operations from the application logic. This dramatically improves the testability of the code. • Application testing is of equal importance to application writing. Testing is difficult and dramatically affects the way the code is structured. • Separation of the client side of an application from the server side. This allows development work to continue in parallel and allows reuse of both the sides. • During the entire lifecycle of building a client-side application, the AngularJS framework helps developers to create a user interface (UI), write business rules, debug, and test the applications. In developing client-side applications, AngularJS is not a single piece in the overall package of the AngularJS framework. AngularJS puts the DOM and AJAX code in a well-defined structure. This makes AngularJS opinionated about how a CRUD application should be built. AngularJS has the following features and advantages: • Implement the CRUD operation, data-binding, basic directives, form validation, routing, deep-linking, reusable components, and dependency injection. • Application testing, such as unit-testing, end-to-end testing, mocks, and test harnesses. • Kernel application with directory layout and test scripts as a starting point. • The AngularJS framework is developed based on the MVC design pattern. It manages these components and connects them to server. • AngularJS uses additional HTML tags to create a user interface for applications. It is much easier, more natural, and less complex than creating a user interface using JavaScript. Creating a user interface with AngularJS within HTML is easy to organize; special tags in the DOM determine which controllers to use for each element. The new tags regulate what should be loaded. AngularJS directives make client-side application development easier because in AngularJS, what you see is what you get. So, instead of wasting time thinking and deciding what has to be done, one can just use the AngularJS framework to simply define what you want and what dependencies are involved.
  • 29. Chapter 1 [ 7 ] • The AngularJS framework uses Plain Old JavaScript Objects (POJO). Therefore, AngularJS does not need the getter or setter functions. We can directly add properties and loops into the objects. The code looks much cleaner and more organized. The traditional data model is responsible for data determination and server synchronization. AngularJS uses the data model, which uses plain objects; these objects behave like temporary storage areas to store and retrieve data. AngularJS's data model works very closely with controller and view and is known as scope. All the properties of the scope object are automatically bound to the calling view of the scope. AngularJS keeps track of the changes made to these properties and updates the view automatically when needed. There is no data in the scope, which depends on the controller to feed the data into the scope, according to the business logic. • The AngularJS framework brings additional functionality to the DOM by introducing supplementary tags to HTML, which are known as directives. Directives empower us to invent our own HTML tags. The MVC application can be separated by putting all DOM manipulations into the directives. This separation will permit the MVC application to only focus on updating view with new data. Directives come in the form of custom HTML tags, such as: <myticker></myticker> <!--<!--<!-- <!--custom attributes - -> <div data-myticker</div> <!--<!--<!-- <!--customer class names - -> <div class="myticker"></div> <!--<!--<!-- <!--used like regular HTML elements - -> • Directives are designed to be standalone reusable elements separate from the application. In fact, if a particular element is adopted by the HTML5 standard, it should be as simple as removing the custom directive. The application should behave in exactly the same manner without needing to change the application. The controller should not manipulate the DOM directly. All DOM manipulations should be performed by directives.
  • 30. Introduction [ 8 ] • The AngularJS framework provides out-of-the-box filter functions. A filter is a separate function like the directive. A filter will filter the data before the data is bound to the view. It is capable of creating a sortable HTML table without writing any JavaScript. In an application, different filters can be applied, such as "currency," which will convert a number into the currency format, "lowercase," which will convert the string to lowercase, "orderBy," which will order the list of items in the ascending or descending filter, and much more. We can also create a custom filter instead of using the out-of-the-box filter. • All the points up till now mean that you get to write less code. You don't have to write your own MVC pipeline. The view is defined using HTML, which is more concise. Data models are simpler to write without getters/ setters. Data-binding means that you don't have to put data into the view manually. Since directives are separate from the app code, they can be written by another team in parallel with minimal integration issues. Filters allow you to manipulate data on the view level without changing your controllers. Yes, this is sort of a summary bullet point, but writing less code is a big deal! • Controllers in AngularJS are functions, which are used to govern the scope. For example, you will use the controller to prefill the data into the scope from the server or to implement business logic validations. In contrast to alternative frameworks, controllers are not objects and there is no inheritance involved. If controllers are easy, then where the work ought to be performed? AngularJS introduces services to do just that. Services are specifically what they sound like. They should not get entangled with the MVC of your application by merely offering associate outward API to reveal no matter what you wish it to reveal. Most of the time, the service syncs up to a server to keep up the associate offline data store and exposes ways to push and pull information to and from a server. AngularJS produces a resource sharing service that enables multiple controllers to share an equivalent resource. Services are designed to be standalone objects that cut loose your application. They permit your controller to stay lean and dedicated to the view and scope that they are assigned to. Services are mainly used to replace the concept of class in object-oriented programming. Of course, implementation of services is not needed and it's utterly acceptable to try and do some lightweight lifting within your controller to avoid over complexness.
  • 31. Chapter 1 [ 9 ] • A PubSub system is a pretty common tool that permits decoupled communication. A PubSub patterned communication between a publisher (sender) and subscriber (receiver) involves transmitted messages characterized as classes, instead of being passed as entire messages. Most PubSub implementations on the Web are not aware of the context. Typically, you would wish a PubSub message to be only legible to the children of a selected node or solely readable by the ancestors of a selected child. In other words, typically, you do not need unrelated MVC parts to read your messages. The PubSub system in AngularJS is exactly that. The broadcast() perform can send a message to all or any child controllers, whereas the emit() perform can send a message to all or any ancestors. However, PubSub is not the only way to communicate with controllers. In fact, if all you are doing is telling different controllers to update their views once a property changes, you must want data binding. However, what I did not tell you is that scopes inherit the properties of their parent scopes. This means that if a property exists on the parent scope and a child scope modifies it, then all different scopes that inherit from the constant parent will see constant modification; their views will be updated mechanically by the current version of AngularJS. • The whole of AngularJS is coupled along by Dependency Injection (DI). This is what it uses to manage your controllers and scopes. As a result, all of your controllers depend on DI to pass information in order to perform unit testing by injecting mock information into your controller and measuring the output and behavior. In fact, AngularJS already incorporates a mock communication protocol supplier to inject faux server responses into the controllers. This beats the additional ancient approach of taking a look at the acting Internet applications by making individual test pages that invoke one part, then interacting with it to envision whether or not it works. The preceding points should provide ample explanation as to why AngularJS is so useful and powerful. Not all web apps use AngularJS. For instance, if you're writing a game or a computationally intensive mathematics program, there's no reason why AngularJS would suit your explicit downside domain. Except for generic Internet apps, it ought to function as a viable framework.
  • 32. Introduction [ 10 ] Getting acquainted with the anatomy of AngularJS In AngularJS applications, view is the Document Object Model (DOM), controllers are the JavaScript functions, and the model data keeps object properties. We need to understand that MVC is needed for many reasons. First, it offers you a mental model for where to place what; therefore, you do not need to invent it each time. Other people collaborating on your project will take a moment to understand what you've written, as they may perceive that you have victimized the MVC structure because you have added your code. Maybe most significantly, we'll claim that it delivers nice edges in creating your app easier to grow, maintain, and test. AngularJS is constructed around the belief that declarative programming ought to be used to build user interfaces and wire software package components, whereas imperative programming is great for expressing business logic. The framework adapts and extends ancient HTML to raise and serve dynamic content through two-way data binding that permits the automated synchronization of models and views. As a result, AngularJS de-emphasizes DOM's manipulation and improves its testability and performance. Separation of the HTML DOM (view) from the application logic (controller) improves the testability of the code in the following way: • Regard application testing to be of equal importance to application writing. Testing issue is dramatically laid low with the method with which the code is structured. • Decouple the client side of the associate degree application from the server side. This permits development work to progress in parallel and permits recycling of either side. • Provides structure for the journey of building associate degree application from planning the UI, through writing the business logic, to testing.
  • 33. Random documents with unrelated content Scribd suggests to you:
  • 34. the stern millionaire, whose heart was steeled against the calls of common humanity. Thus did he argue with himself as to the good that would be done by making the disclosure to Nansie; it would but intensify the sorrow caused by Kingsley's silence into a torture which would be unendurable. If any useful end could have been served by letting Nansie into the secret of her husband's peril Mr. Loveday would not have hesitated to inform her of it; but, so far as he could see, the distress of mind occasioned by the revelation would add misery to misery; and, after some long consideration of the matter, he determined to keep the matter to himself, at least for the present. Meanwhile he watched the papers for further information of the railway accident, but for some time saw no reference to it. One day, however, the following paragraph arrested his attention: "With respect to Mr. Seymour who met his death in the railway accident in Germany, the particulars of which have been fully reported in our columns, it is now certain that he was by birth a Russian, and that he was for a number of years intimately connected with conspiracies against law and order. The documents found upon his person were of such a character, and were so drawn out, as to destroy the hope that was entertained that they would lead to the detection of the members of the secret societies with which he was associated. Great pains have evidently been taken--probably from day to day--to do away with all documentary evidence that would incriminate others, and this is an indirect proof of the dangerous nature of the conspiracies in which he was engaged. With respect to the Mr. Manners who met with serious injuries, nothing to directly implicate him has come to light. The strongest point against him is the fact of his having travelled for many months with Mr. Seymour on apparently confidential relations. Papers found in his possession lead to the conclusion that he is the son of the great contractor, Mr. Valentine Manners, whose name is known all the world over." In the following day's paper Mr. Loveday read a letter to the following effect:
  • 35. "Sir,--It is necessary for me to state that I have not been in any way acquainted with the late movements and proceedings of my son, Mr. Kingsley Manners, who is reported to have met with serious injuries in a railway accident in Germany, nor have I any knowledge of the Mr. Seymour with whom he is said to have travelled as companion. "Faithfully yours, Valentine Manners." That was all. Although Mr. Loveday carefully searched the papers day after day, he saw no further reference to the matter; it dropped out of sight, as it were, and the faint interest it had excited in the public mind appeared to have died completely away. The hard battle of life continued sadly and monotonously, without the occurrence of one cheering incident to lighten the days; and as time wore on Nansie ceased to speak to her uncle of the beloved husband who was either dead or had forgotten her. In her sad musings upon the question of death or forgetfulness she did not bring the matter to an issue. Had she been compelled to do so, she would have stabbed herself with the torture that Kingsley was dead; for that he could have forgotten her, and that he could be systematically neglecting her, was in her faithful, chivalrous heart impossible. All that she could do was to wait, although hope was almost dead within her. At an unexpected moment, however, the question was solved. It was evening. Mr. Loveday had not returned from his daily labors, and Nansie had put her baby asleep in her cradle, and had gone out to execute some small household duties. She hurried through them as quickly as possible, and, returning home, had almost reached the street door of the house in which she lived, when a voice at her back said, "It is Nansie!"
  • 36. The pulses of her heart seemed to stop. It was her husband's voice, and so overcome was she by this sudden ray of sunshine that, when she turned, she could scarcely see before her. Again the voice came to her ears; the gay, light, happy voice of old, which expressed only joy and sweetness, and in which there was no note of sadness or sorrow. "Why, Nansie--it is Nansie! I was born under a lucky star." And still, without seeing the speaker, she felt herself drawn to the heart of the one man in the world she loved--of the dear husband and the father of the babe sleeping peacefully at home. "Oh, Kingsley! Is it you, is it you?" "Of course it is, Nansie. Who else should it be? But it is very perplexing and puzzling; I don't quite see my way out of it. Tell me, Nansie--you expected me, did you not?" "Yes, Kingsley, yes--for so long, for so long!" "No, no, not for so long. Why, it can have been but a few days since I went away! Let me see--how was it? We had to look things in the face, and we did, and we agreed that something must be done, and then--and then--upon my word, Nansie, I think I am growing worse than ever; I not only fly off at a tangent, but I seem to be afflicted by an imp of forgetfulness. What does it matter, though? I have found you, and we are together again." During this speech Nansie's eyes were fixed upon his face in tender love and thoughtfulness. His words were so at variance with the true nature of her position and his that she would have been unable to understand them if love had not brought wisdom to her. There was in Kingsley's eyes the same whimsical expression as of old, there was in his manner the same light-heartedness which had enabled him to look upon the future without anxiety, the tones of his voice were clear and gay, but he bore about him an unmistakable air
  • 37. of poverty. His clothes were worn threadbare, his hands were attenuated and almost transparent, and the lines of his face denoted that he had passed through some great suffering. He evinced no personal consciousness of these signs, and seemed to be at peace and in harmony with himself and all around him. "Are you well, Kingsley?" asked Nansie, solicitously. "Well, my love? Never was better in my life, and now that I have found you, there is nothing more to wish for. And yet--and yet--" He passed his hand across his forehead, and looked at her in a kind of humorous doubt. "Do you observe anything singular in me, my love?" It would have been cruel to have answered him with the direct truth. It was from the deep well of pity with which her heart was filled that she drew forth the words, "No, Kingsley, no." "Are you sure?" "Yes, dear." "I am glad to hear you say so, Nansie. I am the same as ever, eh?" "Yes, Kingsley, the same as ever; but we will not part again." "No, indeed! I don't intend that we shall--because, although we have been separated but a short time, my head has got full of fancies about this and that--foreign countries--outlandish places-- strange people--rapid journeys--accidents even, but dreams, all of them, Nansie. They must be dreams, or I could fix them with greater certainty. Now, you know my old way, my dear; when anything was
  • 38. troubling me I used to say, 'What is the use? It won't make things better.' There is only one wise way to look upon life--make light of things. You remember a favorite saying of mine--it was from a song, I think, was it not? 'Never trouble trouble, till trouble troubles you.' And that is the way we will go through life together, eh, my love?" "Yes, Kingsley," said Nansie, and would have said more, but for a sudden trembling that came over him, which caused him to cling to her for support. "What is the matter, Kingsley?" "To tell you the truth, my dear," he replied, with a wan, whimsical smile, "you would hardly believe it, but I think I am hungry!" "Hungry! Oh, Kingsley!" "Well, yes; such a careless, neglectful fellow as you have got for a husband, Nansie, never thinking of things at the right moment, never taking into account that it is necessary to eat even, until it is forced upon him that he must eat to live. And talking of eating to live--is there anything in the larder, Nansie?" He had rallied a little, and spoke with greater firmness. "Yes, Kingsley, plenty; come--come. Ah, my dear, my dear, with all my heart I thank God that you are with me again!" "Dear wife," he murmured, and allowed himself to be led by her into the house, and up the dark stairs to the rooms she occupied. But outside the door, on the landing, she whispered to him, "Kingsley!" "Yes, love." "There is a great happiness within. Be prepared for it."
  • 39. "There is a great happiness here"--with his arms around her. "I am really and truly thankful." "But a greater within, Kingsley, my husband. Listen--our darling child sleeps there." "Our darling child, our little one! Surely I have seen her in my dreams, in which I have seen so many strange things. Ah, how I have dreamed of you, Nansie, even during this short absence! But let us go in, or I shall be reproached for forgetfulness." They entered the room together, they leaned over the cradle, they knelt by its side, and Kingsley, lowering his face to the pretty babe sleeping there, kissed her softly and tenderly. "She is very sweet, Nansie, like you. I am sure her eyes are the color of yours." "No, darling, she has your eyes." "And your heart, Nansie. Happy little one, happy little one! We will make her happy, will we not, dear?" "Yes, Kingsley." "But, my dear, pardon me for saying so, I am really and truly hungry. Even a piece of dry bread would be acceptable." She kept back her tears, and quickly placed bread upon the table, which he ate ravenously at first, smiling at her gratefully the while. Very soon she had prepared some hot tea, which he drank, and begged her to drink a cup with him. His hunger being appeased, he lay back in his chair, his eyes wandering round the room. "What is our dear little one's name?" he asked; "I have forgotten it."
  • 40. "No, dear," said Nansie, "you have not forgotten it, because she has not one yet; we call her 'baby,' you know." "Yes, yes," he said, "'baby,' of course, the best, the sweetest that ever drew breath; but she must have a name, Nansie; she cannot go through life as 'baby.' Say that when she is a happy woman she marries, it would not do for her to be called 'baby' then." "We waited for you, Kingsley, to give her a name." "Well, then, what shall it be? But that it would introduce confusion into our little home, no better name than 'Nansie' could be found. That would not do, would it?" "No, Kingsley. Shall we give her your mother's name?" "My mother's? No, there must be none but good omens around her. Your mother's, Nansie. I remember you told me it was Hester." Then he called aloud, but in a gentle voice, "Hester!" "She is awake, Kingsley," said Nansie, lifting the baby from the cradle and putting her into his arms.' "This is a great joy to me," he said; "I really think she knows me; we shall be the best of friends. There is so much that is good in the world to show her--to teach her. Now, you and I together, love, will resolve to do our duty by her, and to do all that is in our power to make her happy."
  • 41. CHAPTER XXVII. An hour later, when Mr. Loveday returned home, Nansie, who had been listening for his footsteps, went out to meet him. Even in the dark he, with love's keen sight, observed that something of a pleasant nature had occurred. "Good news, Nansie?" "Speak low, uncle. Yes, good news. He has come home." "Kingsley?" "Yes, uncle. He is asleep with the baby by his side. He is very, very tired." "How did it happen? How did he find you out?" "It must have been almost by chance. I was out making some little purchases, when I suddenly heard a voice behind me saying, quite naturally, 'It is Nansie!' Turning, I saw him, not clearly at first, because I was almost blind with joy. You must be very gentle with him, uncle." "I will, my dear; but there is something in your voice--gentle for any especial reason?" "Yes, for a special reason, which you will more fully discover for yourself. I am glad that I have seen you before he meets you; it will be better that you should be prepared." "Prepared for what, my dear?"
  • 42. "Kingsley is laboring under an impression that he has been away from us but a very short time. What we know to be real he believes to be fancies. He has made no reference to his travels abroad with Mr. Seymour, nor to the railway accident in which he was injured. He speaks of dreams, and even then not clearly. It is difficult for me to make myself understood--" "Not at all, Nansie; I think I understand. The accident he met with has affected his memory; but it is good that he is with us now. We can take care of him, we can nurse him back to strength and health." "How kind you are, uncle! Never thinking of yourself!" "Nonsense, my dear, nonsense! It is entirely of myself that I am thinking, for I would not lose you and your dear ones for all the money the world contains. That is putting a small value upon money, though. I wish we had a little." In his mind was the thought, "We need it all the more now," but he did not give the thought utterance. "Is he low-spirited, despondent, Nansie?" "No, uncle, quite the contrary. He is as light-hearted and gay as ever, and speaks in the same sweet, hopeful strains of the future, his anticipations of which led him into the error of--" She stopped short; she did not complete the sentence. Her uncle completed it for her. "Of marrying you, my dear. Do not regret it; accept it as a blessing, as it really is. Short-sighted mortals as we are to so constantly forget that life is short, and that its sweetest happiness is to be found in self-sacrifice--even, Nansie, in suffering!"
  • 43. They entered the room together, and found Kingsley awake. He rose when his eyes lighted upon Mr. Loveday, and, with a bright smile, said: "Nansie's uncle?" "Yes, Kingsley," said Mr. Loveday. And Nansie raised her uncle's hand to her lips, and kissed it in grateful recognition of the affectionate greeting. "Now," said Kingsley, to whom strength seemed to have really returned; he held out his hand, and retained Mr. Loveday's in his as he spoke--"now what could be pleasanter, what could be brighter and more full of promise? Here, for the first time, we meet, and I recognize in you a friend. Believe me, sir, when I say a friend, it is said once and forever; it is meant once and forever. I am no butterfly, eh, Nansie?" "No, dear Kingsley," she replied, pressing close to him. He passed his arm round her. "No butterfly," continued Kingsley, "except in the way of conversation, but that you will find out for yourself. I fly from one theme to another in the most inconsequential manner. A bad habit, sir, if it really meant anything serious, but it does not, and I have here by my side a spiritual support"--he kissed Nansie--"which never fails to recall me to the straight line at the precise and proper moment--as it does now; for looking at her, I am reminded of all we owe to you. Let me thank you in our joint names. I will not say that I hope to live to repay the debt, because there are some debts which it is good never to repay, and this is one. It is sometimes most ungracious to deliberately cancel an obligation." "The debt is on my side, Kingsley," said Mr. Loveday, greatly won by the returned wanderer's speech and manner. "Nansie has
  • 44. brightened my life." "She could do no less," said Kingsley, in a tone of grave and tender affection, "to the life of any person who has the happiness to know her." Upon the invitation of Mr. Loveday, who knew, now that Kingsley had joined them, that certain changes were necessary in their domestic arrangements, and that Nansie could more readily effect them if she were left alone, the two men went out for a stroll. They returned after an absence of a couple of hours, and Kingsley presented Nansie with a few simple flowers, saying as he did so: "Our honeymoon is not yet over, my love." Presently Kingsley, who, it was apparent, needed repose, was induced to retire to his bed. No sooner had he laid his head upon the pillow than he was fast asleep. Nansie and her uncle sat together in the adjoining room, and conversed in low tones. "It is as you say," observed Mr. Loveday, "he appears to have no memory--that is, no absolute, dependable memory--of what has transpired from the time he left you. I have not directly questioned him, feeling that it might not lead to a good result, and that he is not yet strong enough to bear even a slight shock; but indirectly I threw out a veiled suggestion or two, and his responses have convinced me of his condition. He has a vague impression of a railway accident in which some person whom he knew was killed, and some person whom he knew was injured, but he does not associate either the one or the other directly with himself. You will not mind my mentioning something, my dear, because in our position there must be between us no concealment. Kingsley has no money, not a penny." "It is as I expected, uncle; but how did you discover it? Did he say so?"
  • 45. "No, my dear, it came when he paused before a woman who was selling flowers. He put his hands into his pockets, and was, I think, more perplexed than distressed. 'Now this is too bad,' he remarked, and I, divining, paid the woman for the flowers he selected. It is wonderful to me how, circumstanced as he is, he managed to make his way home." "Providence directed him, and protected him," said Nansie, devoutly, "and will surely smooth the path before us." "With all my heart I hope so," responded Mr. Loveday; "meanwhile, until the better fortune smiles upon us, we must work all the harder, and bring our best courage to bear upon the present." Their conversation was interrupted by a gentle tapping at the door, and, opening it, they saw Timothy Chance, who had a covered basket on his arm which he laid upon the floor, and then respectfully greeted Mr. Loveday and Nansie, who, however, would not be content with this, but shook hands heartily with him. A word of explanation as to Timothy's movements will here be useful. They had not seen him since within a fortnight of the fire which had plunged them so low. When he was convinced that there was no present hope of Mr. Loveday being able to re-establish his business, he had looked out for a situation in the immediate neighborhood, in order that he might be near the friends to whom he was so devotedly attached. But his efforts were not successful; no situation presented itself which he could accept, and as he was driven by necessity, which knows no law, he was compelled to avail himself of an engagement in the country some fifteen miles away, which offered itself in the nick of time. What eventually transpired will be best related in his own words. "You thought I'd forgotten you, sir," he said to Mr. Loveday.
  • 46. "No, my lad, I did not think that. My thought was that you had not been fortunate, and that you kept away out of consideration for us." "Thank you, sir. You have a happy way of saying things. True, too, because I was not very fortunate at first; but there has been a turn in the wheel." "A good turn, Timothy, I hope?" "It will prove so, sir, if I have a head upon my shoulders; always trusting that there are no more fires." "Ah," said Mr. Loveday, "we have had enough of those experiences." "Yes, that we have, sir," responded Timothy, gravely; "but what I say is, 'Never despair.' I have not neglected my studies, sir, and I can give you the Latin words if you like--'Nil desperandum.'" Timothy said this proudly, and with a bright eye. "Good lad," said Mr. Loveday. "It is not in you to despair, Timothy. You are the stuff that men are made of, and will run ahead of all of us." "Never so far ahead, sir," said Timothy, wistfully, "that I shall lose sight of the best friends a poor boy ever had; but that sounds like boastfulness." "Not at all, Timothy, not at all. You speak with as much modesty as resolution. This turn in the wheel, my lad--what kind of a turn?" "I think, sir," said Timothy, with a gay laugh, "that you could guess in once."
  • 47. Mr. Loveday glanced at the basket on the floor, and made a guess in merry mood, for Timothy's blithe spirits were contagious. "Eggs, Timothy?" "Yes, sir," said Timothy, laughing again; "you have guessed it in once--eggs. But before I tell you about it"--he turned to Nansie-- "how is baby?" "Thriving beautifully, Timothy," replied Nansie. "May I see her?" he asked. "Wait a moment," said Nansie, and she went to the inner room, where baby was lying in her cradle. Returning, she said: "Yes, you may see her; but you must be very quiet. Do not make the least noise, and don't be surprised at what you see. My dear husband is home." A bright light came into Timothy's face. "I am glad," he said, "for your sake and baby's." He stepped softly into the bedroom, accompanied by Nansie, and stood in silence for a few moments, gazing affectionately at the sleeping child. "May I kiss her?" he said. "Yes, Timothy, but very, very softly." With the gentleness of a woman he stooped and kissed the child, and then came back with Nansie to the sitting-room, closing the door softly behind him. "Eggs, as you say, sir," he recommenced, taking up the business part of the conversation where it had broken off. "You know that I had to sell off my little stock of fowls here, so that I might get to the
  • 48. situation I heard of. It wasn't a very good one, and it wasn't a very bad one; I had to work hard, which is a thing I shall never complain of, and although, besides my grub, I got very little a week, I managed to save a little out of that. Well, sir, six weeks ago I had two laying hens, and there I was established again in a small way, doing business for myself outside the hours I had to work for my employer. Then came a bit of good-fortune, the turn in the wheel I spoke of. Not far from my place lives a blacksmith, and to him I've been going of a night for a little while past, teaching him to write a bit, teaching him to read a bit, and reading books to him myself that made him laugh and cry. He gets fond of me and we get talking together, especially about eggs. Says I, 'There's a fortune in eggs.' Says he, 'Is there?' Says I, 'No doubt of it.' And three weeks ago-- that is, you know, three weeks after I had set up in business again with my two fowls--I put it all down in figures one night, and we went into it seriously. 'It seems all right,' says he. 'It is all right,' says I. 'Supposing you have not made a mistake,' says he, 'and that you are not being deceived by sparks.' He was hammering away on his anvil, and the sparks were flying up. 'Supposing that,' says he, 'and they are very deceptive creatures--sparks--bright as stars one moment, dead as ghosts the next, how much would it take to start the business?' 'First,' says I, 'there's the ground.' 'I've got that,' says he, 'at the back of the forge; an acre and a half.' 'Then,' says I, 'there's timber for fowl-houses, say enough for thirty to commence with.' 'I've got that,' says he, 'lying idle on the waste ground behind.' 'And nails you've got,' says I. You see, sir, I was speaking with confidence, and rather boldly, because a voice was whispering to me, 'Here's your chance, Timothy.' 'And tools to work nails and timber with,' says I. 'Labor will cost nothing; I should be carpenter and builder.' 'Should you?' says he, 'and I could give you a hand. But an acre and a half of ground and any amount of timber and nails won't lay eggs. Come to the grip--how much money to bring that about?' 'Ten pounds will be ample,' says I. 'I've got that,' says he, 'and more at the back of it. Say ten pounds then.' 'Do you mean it?' says I, my heart almost jumping out of my body. 'I never say what I don't mean,' says he, 'though I don't always say what I do. It is
  • 49. agreed, Timothy, that we go into partnership; rent of ground to be reckoned, nails and tools to be reckoned, timber to be reckoned, and ten pounds to be reckoned, as the capital of the firm. The sooner you start, the better.' I think you know enough of me, sir," continued Timothy, glowing, "to know that I didn't waste an hour. Waste an hour! I didn't waste a minute; and before that week was over the fowl-houses were up, not far away from the forge--because warmth, sir, is a good thing for laying hens--and there was a stock of thirty black Hamburgs to start with. Now, sir and Mrs. Manners, we have been in business just one fortnight, and everything is going on swimmingly. My partner says he never saw such fowls, and says I deal in magic; but the only thing I deal in, sir, is common-sense. So, being fairly started on my way, and having something good to tell, I burned to come and tell it to the friends I honor most; and now I must go. I have to get back to-night; but perhaps you will let me come to see you again." "Indeed, we shall be delighted to see you at any time, Timothy," said Nansie, for he looked at her for an answer. "No one is more rejoiced at your good-fortune, and at the prospect before you, than ourselves." "I know that," said Timothy. "Good-night, and God bless you." "Your basket, Timothy," said Mr. Loveday. "Oh, if you will excuse me, sir, it is yours, and not mine. I have brought it for you, and I hope you will not take it amiss." And off Timothy went, without another word. Opening the basket when he was gone, they took out a score of new-laid eggs and a young fowl trussed for roasting. Tears came into Nansie's eyes. "Did I not say, uncle," she murmured, "that Providence will smooth the path before us?"
  • 51. CHAPTER XXVIII. The week that followed was one of great anxiety to Nansie, springing less from the pecuniary circumstances of their position than from the state of Kingsley's health. The privations and the sufferings he had endured told upon him now that the excitement of the reunion with his wife was over, and for some days he was too weak to leave the house. He himself made light of his sickness, and would not admit that there was anything seriously the matter with him. They made no endeavor to impress this upon him, but he gathered it from the evidences of care and attention by which he was surrounded. There was in the neighborhood a doctor of great skill, who could have practised successfully in fashionable quarters at high fees, but who had deliberately chosen to remain among the poor, whom he loved and attended to with as much devotion as he would have displayed to the highest in the land. His fee was fixed at a shilling; when this was not forthcoming he was content with sixpence, and in many cases with nothing, making no complaints against tardy debtors. This man was always cheerful, ready, and willing, at whatever hour of the day or night; and, without ostentation, he played the part of a true minister to those who needed it most. It is pleasant to be able to limn, even thus briefly, the character of one in whose life and career were exhibited the noblest attributes of human nature. He and Mr. Loveday were friends, and shortly after Nansie came to live with her uncle Dr. Perriera was greatly attracted to her, no less by her gentle manners than by the display of attainments superior to those among whom she lived. When Mr. Loveday was burned out Dr. Perriera was the first to express sympathy with him;
  • 52. he would also have been the first to offer practical assistance had it not been that he was very poor, a fact which troubled him not at all so far as regarded himself, but frequently disturbed him when he came into contact with distress which it was not in his power to relieve. After the fire, when he attended Nansie of his own free will and prompting, he declined to receive any fee whatever, and to this Mr. Loveday did not demur. As his name indicated, Dr. Perriera was of Spanish descent, and could, indeed, trace his genealogical record back to the days when Spain was first among the nations of the world in art, literature, and science. But the dark and heavy hand of bigotry effectually scotched the fair promise which lay before the favored nation, and with the exodus of the Jews--to which race Dr. Perriera belonged-- commenced the decay of a mighty nation. On the day succeeding that of Kingsley's return Mr. Loveday called upon Dr. Perriera, and told him of it. "I am greatly pleased," said Dr. Perriera; "it will be better medicine for Mrs. Manners than the finest drugs in the Pharmacopœia." Then, in order that Dr. Perriera might be in possession of all necessary information, Mr. Loveday made him acquainted with the particulars of Kingsley's association with Mr. Seymour, following those up with the intelligence of the strange hallucination under which Kingsley was laboring with respect to his long absence from home. To Mr. Loveday's surprise, Dr. Perriera showed an intimate knowledge of the movements of the so-called Mr. Seymour, as well as of the secret societies in the interests of which it was said that he travelled. "Of Mr. Manners," said Dr. Perriera, "I know nothing. In Mr. Seymour's transactions he was little better than a cipher, and was
  • 53. probably used as an innocent decoy, or as a means to avert suspicion from the doings of his chief." "How have you become acquainted with these affairs," asked Mr. Loveday; "you, who seem to have no spare moments of time apart from your professional offices?" "I have time and to spare for much," replied Dr. Perriera, smiling. "I keep up rather an extensive correspondence with many European societies which have for their object the advancement of science and humanity." "Humanity!" exclaimed Mr. Loveday. "I call it by that name," said Dr. Perriera. "Were it possible that the ends aimed at could be reached, the toilers of the world would be undoubtedly benefited. The advocated means are frequently pernicious and indefensible; but this occasionally arises from the fact that men of keen intellectual power are goaded to madness by the tyranny of old systems. However, enough of this; I think much but speak little of such matters. I have my small part to play in the world as to the larger and grander movements of which I can simply look on and observe." Dr. Perriera called to see Kingsley, and of his own accord visited him daily. He gave Nansie kindly hope and sympathy, but did not enter into the peculiarities of her husband's case. With Mr. Loveday he was more open. "It is a singular condition," he said. "The loss of memory is not at all uncommon, nor, either, is its recovery; but in most instances this loss is a total loss, time, well-known incidents, relative circumstances, the names of friends and acquaintances, even one's own name, being plunged for a period into absolute obscurity. But here the loss of memory is partial, and the singular phase of it is that it affects only those circumstances of the past which it would be disagreeable to recall. He remembers all that is pleasant and happy
  • 54. in his life, but forgets all that has brought trouble upon him. It belongs to this phase that he is incapable of realizing the privations of the life which seems to lie before him. His temperament is exceptionally bright and cheerful; he looks upon the happy side of nature, and every hopeful sentiment which passes his lips seems to blossom into flower at the moment of its utterance. I can imagine no happier condition of being; but in a poor man it has its grave and most serious side." "How?" inquired Mr. Loveday. "In the fact," replied Dr. Perriera, "that it allows no room for effort, that it affords no incentive to it, that it creates a sure contentment even for a crust of bread, and an utter obliviousness to what may be necessary for those who, he being the head of the family, are naturally dependent upon him." "That is to say," observed Mr. Loveday, "that there is no hope of his being the bread-winner." "None," said Dr. Perriera, "until there is a radical change in him; and I confess to being at a loss as to how this can be effected." The correctness of the good doctor's diagnosis was verified by an incident which did not come to the ears of Nansie or her uncle until after its occurrence. Stronger in body, and able to walk abroad without assistance, Kingsley soon made himself acquainted with all the intricacies of the neighborhood; and on a certain morning he wended his steps to the West-end of the city, and stood before his father's house. Without hesitation he knocked and rang, and upon the door being opened pushed his way past the astonished servant, and walked straight to his father's study. There sat Mr. Manners, who gazed at his son with sternness and some inward agitation which he was successful in concealing. "Good-morning, father," said Kingsley, drawing a chair to the table, and seating himself; then glancing at the papers scattered
  • 55. about, added, in a tone of inquiry, "Fresh contracts?" Mr. Manners did not reply to the question. "What brings you here?" he asked. Kingsley had grown thinner since he last saw him, and that circumstance and the shabbiness of Kingsley's appearance suddenly inspired in the heart of Mr. Manners the hope that his son had come to him in submission. "I was anxious about you, father," said Kingsley, in an affectionate tone, "it seems so long since we saw each other. A son must not be forgetful of his duties." "Ah," said Mr. Manners, his hope growing, "you recognize that at last?" "At last!" said Kingsley, in a tone of cheerful surprise. "I have always recognized it. I cannot recall that I have ever been wanting in my duty to you." Mr. Manners stared at his son, debating now within himself what kind of part Kingsley had come to play. There was a silence of a few moments, during which Kingsley gazed at the familiar objects of the room with great calmness, and quite at his ease. "The object of your visit?" demanded Mr. Manners. "I have told you, father. Are you well?" "Yes, I am well." "And happy?" "Yes," replied Mr. Manners, setting his teeth, "and happy. That knowledge will hurt you, perhaps."
  • 56. "Why, no, father, it delights me. Everything, as usual, prospers with you, of course." "Everything, as usual, prospers with me," said Mr. Manners, mechanically. "Did you inquire of the servant if I was at home?" "No, why should I? It was my home once as well as yours." "But is no longer," said Mr. Manners, with a deepening frown. "Oh, well, no, in a certain sense," said Kingsley, "not directly, but indirectly still my home as well as yours. There are ties which can never be broken, and which you, in the goodness of your heart, would never wish to be broken. I should not like to hear from any man's lips that you think otherwise; I am afraid I should say something unpleasant to him." Kingsley's cordial manner and cheerful voice would have mystified most men with a weaker order of mind than Mr. Manners's; but although this was not the case with the great contractor, he was certainly at a loss to account for them. He knew that Kingsley possessed a soul of frankness and honesty, and he could not readily bring himself to believe that it was cunning and duplicity which had induced his son to seek this interview. Still, for the exhibition of these qualities he would have been, as he always was with all men, perfectly prepared, but not for the ingenuousness with which he was now confronted. He thought to turn the tables upon Kingsley. "Are you well?" he asked. "Quite well, father," replied Kingsley. "And happy?" "Quite happy, father." "And prosperous?"
  • 57. "To be quite well and happy," said Kingsley, in no spirit of evasion, "is not that a prosperous state?" "You are quibbling with me," said Mr. Manners, "and I am not in the mood, and have no time for trifling." "I shall not detain you long, father; you have eased my mind, and I shall go away presently, quite contented. As to quibbling, you, who know me so well and have been so good to me, must know that I am incapable of such conduct." "I decline to argue with you. Come to the point at once. You wish to make some kind of appeal to me. I did hope that you had come in submission." "I have, father; submission in all things that accord with one's duty." "With your duty to me?" "To you and to others who are dear to me." "I will not listen," said Mr. Manners, "to anything concerning them." "I will not force it upon you. There shall be nothing discordant between us. But what do you mean by 'appeal?'" "You are here to ask for money, as those who have separated us have been here before you." "Indeed, you are quite wrong. There has been, there shall be, no separation between us. I love you as I have always done, as I always shall love you. And they appealed to you for money! Did you give it to them?" "No, nor will I to you."
  • 58. "Oh, but I need none. You have been since my earliest remembrance most liberal to me, but you cannot accuse me of being mercenary. I should like you to know my wife, I should like you to know and love our child. If you are too busy for that now, we will wait; when you visit us, which surely you will do some day, you will be pleased at the manner in which we shall receive you; all the honor that is due to you shall be cheerfully rendered." "This mockery must end," said Mr. Manners; "go! But, before you leave, it will, perhaps, be as well for me to say what is in my mind." "Yes, father," said Kingsley, gently. "I do not know," said Mr. Manners, in a set, hard tone, "whether I should ever have been inclined to forgive your disobedience and undutifulness; I do not know, after what has passed, whether, you being my son upon whom once all my hopes were centred, I should have been disposed to once more hold out my hand to you. I think it would not have been possible, but there may have been, at least, some remote chance of a partial reconciliation. If there was such a chance, you have utterly destroyed it by your conduct during the past few months." "What conduct do you refer to?" asked Kingsley, smiling. "You surely are laboring under some delusion!" "It is no delusion," said Mr. Manners, "that you have been travelling for some time with a person of infamous character and designs!" "Surely it must be, father. Does the man live? If he does, he will disprove it." "I will fall in with your humor," said Mr. Manners, "and will pay no attention to your amazing evasions; all the more amazing, all the more inexcusable, when adopted towards a man like myself. Do you pretend that you are unacquainted with the person who travelled
  • 59. under the name of Seymour? Do you pretend that travelling in close association with him as you did for so long a time, you had no connection with the designs he was wishful to promote?" "You remind me strangely," replied Kingsley, "of something which has been troubling me--no, I am wrong in saying troubling me, I mean that has been interesting me. There have undoubtedly been some such designs as you refer to, mysterious and inexplicable enough to me, but the interesting part of the matter is, how did it ever come into my mind that I could have been associated with them? Clearly, I must have evolved the idea out of a too vivid imagination; because I cannot trace the slightest actual connection between me and them. Similarly, too, with the name you have mentioned--Seymour. How did it come into my mind that I knew such a gentleman? Clearly, he must have existed; and now there occurs to me a dim remembrance of a railway accident in which a gentleman of the name of Seymour was killed, and many were injured. How comes the knowledge of that circumstance to me? May I not also have evolved that from my imagination? Anyway, I shall not allow myself to be troubled by matters which I cannot directly trace, though I cannot avoid being interested in them. But what you have said has another bearing, as though I had done something to disgrace my name. Of course such a thing would be impossible, and if I am indebted to any ill-natured person for having aroused in you any suspicion to my hurt, I make him my hearty acknowledgments without bearing the slightest ill-will against him, because, after all, father, a serious calumny should not be allowed to have weight unless an absolute foundation of fact can be brought forward, as cannot be done in my case. Man must be judged by his own actions, not by what people say of him. You infer that this Mr. Seymour travelled to promote infamous designs with which you suppose me to be in sympathy. What designs, father?" "Republicanism," said Mr. Manners, not displeased at being brought to the point, "Socialism, Communism, and the overthrow of existing institutions, which are a blessing to mankind."
  • 60. "Ah, but there, you know," said Kingsley, with no departure from his light mood, "you open up debatable matter. It is not disagreeable to me. I was always fond of argument, although I have been accused of too freely wandering away from one upon the slightest excuse. You condemn Republicanism, but I think I would sooner live under a republic than a monarchy." "What you say confirms the accusation I and others bring against you." "Not at all. I am merely expressing my view of a large matter. You see, father, there is so much misery in the world, so much undeserved suffering, so much compulsory poverty, such astounding inequalities in the social condition of the people, that a fair-minded man cannot possibly avoid wishing to remedy these ills. What are you touching the bell for?" "For the servant to show you to the door." "I do not need him; I know my way out. Your time is valuable, and it is inconsiderate of me to take up so much of it. Is my mother in?" "No." "I am sorry; I wished to see her. She is well, I hope." "Quite well. She has not a sorrow in the world. And now, for the last time, leave the room--and the house." His peremptory, harsh tone had no effect upon Kingsley, who, with a genial nod and a "Good-morning, father," left the house with a light step. In the evening he informed Nansie and Mr. Loveday of his visit to his father, and, to their astonishment, described it as one of a pleasant character. Their astonishment was all the greater when they
  • 61. read a letter which was delivered personally to Kingsley. It was from a firm of lawyers, and was written in accordance with instructions received from Mr. Manners. In the first place it conveyed an intimation that Kingsley would not be allowed again to enter his father's house; in the second place it contained a warning that if he made any further endeavor to force himself into his father's presence, proceedings would be taken against him for the trespass. "I think," said Kingsley, "that lawyers must have been invented expressly to torment mankind; they never can put a thing pleasantly. My father, I suppose, is too busy to write to me himself, so he told his lawyers to do so, and they, wishing to make things as unpleasant as possible, send me a communication couched in terms which my father would certainly resent. Of course I shall not go to him again until he sends for me." So saying, he tore up the letter and put it into the fire. A few days afterwards it was announced in the papers that Mr. Manners had broken up his London establishment, and with his wife and his nephew, Mr. Mark Inglefield, had started on a foreign tour, which was likely to be of long duration. This paragraph was read by Kingsley, and caused in him the first spark of resentment he had exhibited since his return. "I am sorry," he said, "that my father has taken up with such a man as Mark Inglefield. He is dangerous and coldblooded, and, I am afraid, no friend of mine. Not that I want him for a friend, but that, being with my father, he may say something against us. However, to use your dear mother's saying, Nansie, 'Everything will come right in the end.'" With this comfortable assurance he dismissed the matter from his mind, as was his habit.
  • 62. Welcome to our website – the ideal destination for book lovers and knowledge seekers. With a mission to inspire endlessly, we offer a vast collection of books, ranging from classic literary works to specialized publications, self-development books, and children's literature. Each book is a new journey of discovery, expanding knowledge and enriching the soul of the reade Our website is not just a platform for buying books, but a bridge connecting readers to the timeless values of culture and wisdom. With an elegant, user-friendly interface and an intelligent search system, we are committed to providing a quick and convenient shopping experience. Additionally, our special promotions and home delivery services ensure that you save time and fully enjoy the joy of reading. Let us accompany you on the journey of exploring knowledge and personal growth! textbookfull.com