Angular 2 ui development Kasagoni download pdf
Angular 2 ui development Kasagoni download pdf
com
https://textbookfull.com/product/angular-2-ui-development-
kasagoni/
OR CLICK BUTTON
DOWNLOAD NOW
https://textbookfull.com/product/angular-2-cookbook-frisbie/
textboxfull.com
https://textbookfull.com/product/angular-development-with-typescript-
second-edition-yakov-fain/
textboxfull.com
https://textbookfull.com/product/ui-design-for-ios-app-development-
using-swiftui-bear-cahill/
textboxfull.com
Ang-book 2: The Complete Book on Angular 2 1st Edition
Nate Murray
https://textbookfull.com/product/ang-book-2-the-complete-book-on-
angular-2-1st-edition-nate-murray/
textboxfull.com
https://textbookfull.com/product/mobile-app-development-with-ionic-
cross-platform-apps-with-ionic-angular-and-cordova-griffith/
textboxfull.com
https://textbookfull.com/product/angular-up-and-running-learning-
angular-step-by-step-shyam-seshadri/
textboxfull.com
https://textbookfull.com/product/practical-ui-2nd-edition-adham-
dannaway/
textboxfull.com
www.ebook3000.com
Building Modern Web
Applications Using Angular
BIRMINGHAM - MUMBAI
Building Modern Web Applications Using
Angular
Copyright © 2017 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 author, 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.
www.ebook3000.com
Credits
Production Coordinator
Melwyn Dsa
About the Author
Shravan Kumar Kasagoni is a developer, gadget freak, technology evangelist, mentor,
blogger, and speaker living in Hyderabad. He has been passionate about computers and
technology right from childhood. He holds a bachelors degree in computer science and
engineering, and he is a Microsoft Certified Professional.
His expertise includes modern web technologies (HTML5, JavaScript, and Node.js) and
frameworks (Angular, React.js, Knockout.js, and so on). He has also worked on many
Microsoft technologies, such as ASP.NET MVC, ASP.NET WEB API, WCF, C#, SSRS, and
the Microsoft cloud platform Azure.
He is currently working with Novartis India, where he is responsible for the design and
development of high-performance modern enterprise web applications and RESTful APIs.
Previously, he was associated with Thomson Reuters and Pramati Technologies.
I would like to thank my wife for putting up with my late-night writing sessions, my
parents, and brother for their constant support. I also give deep thanks and express
gratitude to my close friends, Pranav and Ashwini Reddy, who have always been there to
encourage, guide, and help me.
I would also like to thank my former colleagues Monisha and Dharmendra, and my friends,
Abhijit Jana, Sudhakar, Subhendu, Sai Kiran, Srikar Ananthula, and Raghu Ram. I am
thankful to my mentors, Nagaraju Bende and Mallikarjun, without whom I may not have
got here.
www.ebook3000.com
About the Reviewers
Hemant Singh is a developer living in Hyderabad/AP, India. Currently, he is working for
Microsoft as a UX consultant. He loves open source, and is active in various projects.
Hemant is not much of a blogger, but tries to share information whenever possible.
He handcrafts CSS and HTML documents and handles JavaScript (the good parts). It won’t
be surprising if he tells you that he fell in love with HTML5 and, of course, CSS3. Hemant
also has a passion for user interface and experience design and tries to show some of his
work in his portfolio.
He is an open source enthusiast, and has created a series of projects in GitHub. After his
daily work, he likes to reinvent some wheels for fun. He created the application Growth
with Ionic 2 and Angular 2 , which is about coaching newbies about programming. You can
find out more about wheels on his GitHub page, http://github.com/phodal.
He loves designing, writing, hacking, and traveling. You can also find out more about him
on his personal website at http://www.phodal.com.
www.PacktPub.com
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.
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt
books and video courses, as well as industry-leading tools to help you plan your personal
development and advance your career.
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
www.ebook3000.com
Customer Feedback
Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial
process. To help us improve, please leave us an honest review on this book's Amazon page
at https://www.amazon.com/dp/1785880721.
If you'd like to join our team of regular reviewers, you can e-mail us at
customerreviews@packtpub.com. We award our regular reviewers with free eBooks and
videos in exchange for their valuable feedback. Help us be relentless in improving our
products!
Table of Contents
Preface 1
Chapter 1: Getting Started 6
Introduction to Angular 6
What is new in Angular? 7
Setting up the environment 7
Installing Node.js and npm 8
Language choices 8
ECMAScript 5 9
ECMAScript 2015 9
TypeScript 9
Installing TypeScript 10
TypeScript basics – types 10
String 11
Number 11
Boolean 11
Array 11
Enum 11
Any 12
Void 12
Functions 13
Function declaration – named function 14
Function expression – anonymous function 14
Classes 14
Writing your first Angular application 16
Set up the Angular application 16
Step 1 16
Step 2 18
Step 4 19
Step 5 20
Step 6 21
Step 7 22
Step 8 22
SystemJS 23
Using the Angular component 24
Understanding npm packages 25
Step 9 26
Step 10 26
Using Angular CLI 28
www.ebook3000.com
Getting started with Angular CLI 28
Summary 29
Chapter 2: Basics of Components 31
Getting started 31
Project setup 31
Working with data 34
Displaying data 35
Interpolation syntax 35
Property binding 37
Attribute binding 38
Event binding 38
Two-way data binding 41
Built-in directives 42
Structural directives 42
ngIf 43
ngFor 43
Understanding ngFor syntax 43
ngSwitch 44
Attribute directives 45
ngStyle 45
ngClass 46
Building the master-detail component 47
Summary 53
Chapter 3: Components, Services, and Dependency Injection 54
Introduction 54
Working with multiple components 55
Input properties 57
Aliasing input properties 58
Output properties 59
Aliasing output properties 61
Sharing data using services 63
Dependency injection 67
Using a class provider 67
Using a class provider with dependencies 68
Using alternate class providers 69
Using aliased class providers 70
Summary 71
Chapter 4: Working with Observables 72
Basics of RxJS and Observables 72
Reactive programming 72
[ ii ]
Observer 73
Observable 74
Subscription 76
Operators 76
Observables in Angular 77
Observable stream and mapping values 77
Merging Observable streams 78
Using the Observable.interval() method 79
Using AsyncPipe 81
Building a Books Search component 82
Summary 90
Chapter 5: Handling Forms 91
Why are forms hard? 91
Angular forms API 91
FormControl, FormGroup, and FormArray 92
FormControl 92
Creating a form control 92
Accessing the value of an input control 93
Setting the value of input control 93
Resetting the value of an input control 93
Input control states 93
FormGroup 94
FormArray 95
Template driven forms 96
Creating a registration form 96
Using the ngModel directive 99
Accessing an input control value using ngModel 100
Using ngModel to bind a string value 101
Using ngModel to bind a component property 102
Using the ngForm directive 105
Submitting a form using the ngSubmit method 106
Using the ngModelGroup directive 110
Adding validations to the registration form 112
Pros and cons of template driven forms 116
Reactive forms 117
Creating a registration form using reactive forms 117
Using FormGroup, FormControl, and Validators 118
Using [formGroup], formControlName, and formGroupName 119
Using FormBuilder 121
CustomValidators 122
Pros and cons of reactive forms 125
Summary 125
[ iii ]
www.ebook3000.com
Chapter 6: Building a Book Store Application 126
Book Store application 126
HTTP 126
Making GET requests 131
Routing 137
Defining routes 137
RouterOutlet Directive 139
Named RouterOutlet 142
Navigation 142
Route params 142
Animating routed components 148
Feature modules using @NgModule() 150
Summary 153
Chapter 7: Testing 154
Testing 154
Unit testing 155
End-to-end testing 155
Tooling 155
Configuration files 155
Jasmine basics 156
Unit testing 157
Isolated unit tests 157
Writing basic isolated unit tests 159
Testing services 161
Mocking dependencies 162
Testing components 164
Integrated unit tests 165
Testing components 165
Testing components with dependencies 169
Summary 172
Chapter 8: Angular Material 173
Introduction 173
Getting started 173
Project setup 174
Using Angular Material components 176
Master-detail page 176
Books list page 183
Add book dialog 189
User registration form 193
[ iv ]
Adding themes 197
Summary 199
Index 200
[v]
www.ebook3000.com
Preface
Building Modern Web Applications Using Angular helps readers to design and develop
modern web applications. It provides a solid understanding of the Angular 4 framework.
Readers will learn how to build and architect high-performance web applications mainly
focusing on UI. This is an end-to-end guide for all the new features in Angular 4. This book
also covers some of the latest JavaScript concepts in ECMAScript 2015, ECMAScript 2016,
and TypeScript.
This book will take you from nowhere when it comes to building UI applications for Web
and mobile to become a master using Angular 4. It will explain almost every feature of the
Angular 4 framework with a particle approach and lots of examples, showing how to use
them in real-world scenarios to build compelling UI applications. Chapters at the end of the
book are dedicated to show how to build an end-to-end application UI using individual
Angular 4 features that were explained in previous chapters.
Chapter 3, Components, Services, and Dependency Injection, walks through how to develop
Angular 4 applications using multiple components, communicating between components,
sharing the data between these components using services and injecting services using
dependency injection, as well as how dependency injection works.
Chapter 5, Handling Forms, introduces how to create different types of forms in Angular 4
applications to accept user input and validate it using template-driven forms, reactive
forms, and validation directives.
Chapter 6, Building a Book Store Application, walks through how to structure tiny to a
complex application using Angular 4 modules, build various types of user interfaces in a
Book Store application, navigate between components using routing, interact with the
server using the HTTP service.
Chapter 7, Testing, introduces how to write unit tests using Jasmine and Angular Test
Utilities for various parts of Angular 4 applications.
Chapter 8, Angular Material, walks through how to build a single compelling UI, which
flows across desktops, tablets, and mobile devices, using material design, and learning how
to customize material design as per customer branding.
Operating system:
MAC OS X 10.9 and higher
WINDOWS 7 and higher
Node.js 6:
MAC: https://nodejs.org/dist/v6.10.3/node-v6.10.3.pkg
Windows: https://nodejs.org/dist/v6.10.3/node-v6.10.3-x
64.msi
Any code editor
Visual Studio Code
Sublime
[2]
www.ebook3000.com
Preface
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, folder names, filenames, file extensions, path names, URLs, user input,
and Twitter handles are shown as follows:
@Component({
selector: 'hello-world-app',
template: '<h1>Say Hello to Angular</h1>'
})
class HelloWorldAppComponent { }
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: "Clicking the Next button
moves you to the next screen."
[3]
Preface
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.
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.
1. Log in or register to our website using your e-mail address and password.
2. Hover the mouse pointer on the SUPPORT tab at the top.
3. Click on Code Downloads & Errata.
4. Enter the name of the book in the Search box.
5. Select the book for which you're looking to download the code files.
6. Choose from the drop-down menu where you purchased this book from.
7. Click on Code Download.
Once the file is downloaded, please make sure that you unzip or extract the folder using the
latest version of:
[4]
www.ebook3000.com
Preface
The complete set of code can also be downloaded from the following GitHub repository: ht
tps://github.com/PacktPublishing/Building-Modern-Web-Application-using-Angul
ar. We also have other code bundles from our rich catalog of books and videos available at:
https://github.com/PacktPublishing/. Check them out!
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.
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.
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.
[5]
Getting Started
1
In this chapter, we are going to learn the Angular framework basics and new features. We
will learn how to use features from future versions of JavaScript and TypeScript to develop
modern web applications using Angular. After going through this chapter, the reader will
understand the following concepts:
Introduction to Angular
What is Angular? It is an open source modern JavaScript framework in order to build the
Web, mobile web, native mobile, and native desktop applications. It can also be used in
combination with any server-side web application framework, such as ASP.NET and
Node.js. Angular is the successor of AngularJS 1, which is one of the best JavaScript
frameworks for building client-slide web applications, used by millions of developers
across the globe.
Even though the developer community highly appreciates AngularJS 1, it has its challenges.
Many developers feel that the AngularJS 1 learning curve is high. Out-of-the-box
performance in complex applications with a huge amount of data is not that great, which is
essential in enterprise applications. The API to build directives is very confusing and
complex, even for an experienced AngularJS 1 programmer, which is the key concept to
build UI applications based component-based architecture.
www.ebook3000.com
Getting Started
Angular is the next version of AngularJS 1.x, but it is a complete rewrite from its
predecessor. It is built on top of the latest web standards (web components, Observables,
and decorators), the learning curve is minimal, and performance is better. This book will
cover the latest version of Angular, which is version 4, at the time of writing this book.
Angular 4 is an incremental update from Angular 2, unlike Angular 2.
When we use the term Angular, we are referring to the latest version of
the framework. Anywhere we need to discuss version 1.x, we will use the
term AngularJS.
Components
New templating syntax
Unidirectional data flow
Ultra-fast change detection
New component router
Observables
Server-side rendering
New languages for development
ES2015
TypeScript
Ahead of time compilation
[7]
Getting Started
Node.js is a platform built on top of V8, Google's JavaScript runtime, which also
powers the Chrome browser
Node.js is used for developing server-side JavaScript applications
The npm is a package manager for Node.js, which makes it quite simple to install
additional tools via packages; it comes bundled with Node.js
Once we install Node.js, run the following commands on the command line in Windows or
Terminal in macOS to verify that Node.js and npm are installed and set up properly:
$ node -v
$ npm -v
The preceding commands will display currently installed Node.js and npm versions,
respectively:
Language choices
We can write the Angular applications in JavaScript or any language that can be compiled
into JavaScript. Here, we are going to discuss the three primary language choices.
[8]
www.ebook3000.com
Getting Started
ECMAScript 5
ECMAScript 5 (ES5) is the version of JavaScript that runs in today's browsers. The code
written in ES5 does not require any additional transpilation or compilation, and there is no
new learning curve. We can use this as it is to develop Angular applications.
ECMAScript 2015
ECMAScript 2015 (ES2015), previously known as ECMAScript 6 (ES6), is the next version
of JavaScript. ES2015 is a significant update to the JavaScript language; the code written in
ES2015 is a lot cleaner than ES5. ES2015 includes a lot of new features to increase the
expressiveness of JavaScript code (for example, classes, arrows, and template strings).
However, today's browsers do not support all the features of ES2015 completely (for more
information please refer to: https://caniuse.com/#search=es6). We need to use
transpilers like Babel to transform ES2015 code into ES5-compatible code so that it works in
today's browsers.
TypeScript
TypeScript is a superset of JavaScript, which means all the code written in JavaScript is
valid TypeScript code, and TypeScript compiles back to simple standards-based JavaScript
code, which runs on any browser, for any host, on any OS. TypeScript lets us write
idiomatic JavaScript. It provides optional static types that are useful for building scalable
JavaScript applications and other features such as classes, modules, and decorators from
future versions of the JavaScript.
It provides the following features to improve developer productivity and build scalable
JavaScript applications:
Static checking
Symbol-based navigation
Statement completion
Code refactoring
[9]
Getting Started
Installing TypeScript
We can install TypeScript in multiple ways, and we are going to use npm, which we
installed earlier. Go to the command line in Windows or Terminal in macOS and run the
following command:
$ npm install -g typescript
The preceding command will install the TypeScript compiler and makes it available
globally.
JavaScript is a loosely typed language, and we do not need to declare the type of a variable
ahead of time. The type will be determined automatically while the program is being
executed. Because of the dynamic nature of JavaScript, it does not guarantee any type
safety. TypeScript provides an optional type system to ensure type safety.
[ 10 ]
www.ebook3000.com
Getting Started
In this section, we are going learn the important data types in TypeScript.
String
In TypeScript, we can use either double quotes (") or single quotes (') to surround strings
similar to JavaScript.
var bookName: string = "Angular";
bookName = 'Angular UI Development';
Number
As in JavaScript, all numbers in TypeScript are floating point values:
var version: number = 4;
Boolean
The boolean data type represents the true/false value:
var isCompleted: boolean = false;
Array
We have two different syntaxes to describe arrays, and the first syntax uses the element
type followed by []:
var fw: string[] = ['Angular', 'React', 'Ember'];
Enum
TypeScript includes the enum data type along with the standard set of data types from
JavaScript. In languages such as C# and JAVA, an enum is a way of giving more friendly
names to sets of numeric values, as shown in the following code snippet:
enum Frameworks { Angular, React, Ember };
var f: Frameworks = Frameworks.Angular;
[ 11 ]
Getting Started
The numbering of members in the enum type starts with 0 by default. We can change this
by manually setting the value of one of its members. As illustrated earlier, in code snippet,
the Frameworks.Angular value is 0, the Frameworks.React value is 1, and the
Frameworks.Ember value is 2.
We can change the starting value of enum type to 5 instead of 0, and remaining members
follow the starting value:
enum Frameworks { Angular = 5, React, Ember };
var f: Frameworks = Frameworks.Angular;
var r: Frameworks = Frameworks.React;
Any
If we need to opt out type-checking in TypeScript to store any value in a variable whose
type is not known right away, we can use any keyword to declare that variable:
var eventId: any = 7890;
eventId = 'event1';
In the preceding code snippet while declaring a variable, we are initializing it with the
number value, but later we are assigning the string value to the same variable. TypeScript
compiler will not report any errors because of any keyword. Here is one more example of
an array storing different data type values:
var myCollection:any[] = ["value1", 100, 'test', true];
myCollection[2] = false;
Void
The void keyword represents not having any data type. Functions without return
keyword do not return any value, and we use void to represent it.
function simpleMessage(): void {
alert("Hey! I return void");
}
[ 12 ]
www.ebook3000.com
Getting Started
Let's write our first TypeScript example and save it into the example1.ts file:
var bookName: string = 'Angular UI Development';
var version: number = 2;
var isCompleted: boolean = false;
var frameworks1: string[] = ['Angular', 'React', 'Ember'];
var frameworks2: Array<string> = ['Angular', 'React', 'Ember'];
enum Framework { Angular, React, Ember };
var f: Framework = Framework.Angular;
var eventId: any = 7890;
eventId = 'event1';
var myCollection:any[] = ['value1', 100, 'test', true];
myCollection[2] = false;
Let's compile the example1.ts file using the TypeScript command-line compiler:
$ tsc example1.ts
The preceding command will compile TypeScript code into plain JavaScript code into the
example1.js file; this is how it will look, and it is plain JavaScript:
Functions
Functions are the fundamental building blocks of any JavaScript application. In JavaScript,
we declare functions in two ways.
[ 13 ]
Getting Started
In JavaScript, unlike any other concept, there is no type safety for functions also. We do not
have any assurance on data types of parameters, return type, the number of parameters
passed to function, TypeScript guarantees all this. It supports both the syntaxes.
The preceding TypeScript functions are very similar to the JavaScript syntax except
parameters, and return type has type on them, which ensures type safety while invoking
them.
Classes
The ES5 does not have the concept of classes. However, we can mimic the class structure
using different JavaScript patterns. The ES2015 does support classes. However, today, we
can already write them in TypeScript. In fact, the ECMAScript 2015 class syntax is inspired
by TypeScript.
[ 14 ]
www.ebook3000.com
Getting Started
The preceding Person class has three members - a property named name, a constructor,
and a method sayHello. We should use this keyword to refer to the properties of the class.
We created an instance of the Person class using the new operator. In the next step, we
invoke the sayHello() method of the Person class using its instance created in the
previous step.
Save the preceding code into the person.ts file and compile it using the TypeScript
command-line compiler. It will compile TypeScript code into plain JavaScript code into the
person.js file:
$ tsc person.ts
Here is the plain JavaScript code, which was compiled from the TypeScript class:
var Person = (function () {
function Person(name) {
this.name = name;
}
Person.prototype.sayHello = function () {
return 'Hello ' + this.name;
};
return Person;
}());
[ 15 ]
Getting Started
The Angular application component tree will have one root component; it will act as
the entry point of the application. All the other components that are part of the application
will load inside the root component, and they can be nested in any way that we need inside
the root component.
Angular also has the concept of modules, which are used for grouping components with
similar functionality. An Angular application should have minimum one module and
minimum one component that should be part of that module. Component acts as root
component, and module acts as root module.
Step 1
As we are going to write our application in TypeScript, let us begin with the
tsconfig.json file first. It is the TypeScript configuration file that contains instructions for
its compiler on how to compile TypeScript code into JavaScript. If we do not use the
tsconfig.json file, the TypeScript compiler uses the default flags during compilation, or
we can pass our flags manually every time while compiling.
[ 16 ]
www.ebook3000.com
Exploring the Variety of Random
Documents with Different Content
be concluded from their doctrine. And by a happy utterance of
divination, not without divine help, concurring in certain prophetic
declarations, and seizing the truth in portions and aspects, in terms
not obscure, and not going beyond the explanation of the things,
they honoured it on ascertaining the appearance of relation with the
truth. Whence the Hellenic philosophy is like the torch of wick which
men kindle, artificially stealing the light from the sun. But on the
proclamation of the Word all that holy light shone forth. Then in
houses by night the stolen light is useful; but by day the fire blazes,
and all the night is illuminated by such a sun of intellectual light.
Now Pythagoras made an epitome of the statements on
righteousness in Moses, when he said, “Do not step over the
balance;” that is, do not transgress equality in distribution,
honouring justice so.
“Which friends to friends for ever,
To cities, cities—to allies, allies binds,
For equality is what is right for men;
But less to greater ever hostile grows,
And days of hate begin,”
And Atlas,[767] the unsuffering pole, may mean the fixed sphere, or
better perhaps, motionless eternity. But I think it better to regard
the ark, so called from the Hebrew word Thebotha,[768] as signifying
something else. It is interpreted, one instead of one in all places.
Whether, then, it is the eighth region and the world of thought, or
God, all-embracing, and without shape, and invisible, that is
indicated, we may for the present defer saying. But it signifies the
repose which dwells with the adoring spirits, which are meant by the
cherubim.
For He who prohibited the making of a graven image, would
never Himself have made an image in the likeness of holy things.
Nor is there at all any composite thing, and creature endowed with
sensation, of the sort in heaven. But the face is a symbol of the
rational soul, and the wings are the lofty ministers and energies of
powers right and left; and the voice is delightsome glory in ceaseless
contemplation. Let it suffice that the mystic interpretation has
advanced so far.
Now the high priest’s robe is the symbol of the world of sense.
The seven planets are represented by the five stones and the two
carbuncles, for Saturn and the Moon. The former is southern, and
moist, and earthy, and heavy; the latter aerial, whence she is called
by some Artemis, as if Aerotomos (cutting the air); and the air is
cloudy. And co-operating as they did in the production of things here
below, those that by Divine Providence are set over the planets are
rightly represented as placed on the breast and shoulders; and by
them was the work of creation, the first week. And the breast is the
seat of the heart and soul.
Differently, the stones might be the various phases of salvation;
some occupying the upper, some the lower parts of the entire body
saved. The three hundred and sixty bells, suspended from the robe,
is the space of a year, “the acceptable year of the Lord,” proclaiming
and resounding the stupendous manifestation of the Saviour.
Further, the broad gold mitre indicates the regal power of the Lord,
“since the head of the church” is the Saviour.[769] The mitre that is
on it [i.e. the head] is, then, a sign of most princely rule; and
otherwise we have heard it said, “The Head of Christ is the God and
Father of our Lord Jesus Christ.”[770] Moreover, there was the
breastplate, comprising the ephod, which is the symbol of work, and
the oracle (λογίον); and this indicated the Word (λόγος) by which it
was framed, and is the symbol of heaven, made by the Word,[771]
and subjected to Christ, the Head of all things, inasmuch as it moves
in the same way, and in a like manner. The luminous emerald
stones, therefore, in the ephod, signify the sun and moon, the
helpers of nature. The shoulder, I take it, is the commencement of
the hand.
The twelve stones, set in four rows on the breast, describe for us
the circle of the zodiac, in the four changes of the year. It was
otherwise requisite that the law and the prophets should be placed
beneath the Lord’s head, because in both Testaments mention is
made of the righteous. For were we to say that the apostles were at
once prophets and righteous, we should say well, “since one and the
self-same Holy Spirit works in all.”[772] And as the Lord is above the
whole world, yea, above the world of thought, so the name
engraven on the plate has been regarded to signify, above all rule
and authority; and it was inscribed with reference both to the
written commandments and the manifestation to sense. And it is the
name of God that is expressed; since, as the Son sees the goodness
of the Father, God the Saviour works, being called the first principle
of all things, which was imaged forth from the invisible God first, and
before the ages, and which fashioned all things which came into
being after itself. Nay more, the oracle[773] exhibits the prophecy
which by the Word cries and preaches, and the judgment that is to
come; since it is the same Word which prophesies, and judges, and
discriminates all things.
And they say that the robe prophesied the ministry in the flesh,
by which He was seen in closer relation to the world. So the high
priest, putting off his consecrated robe (the universe, and the
creation in the universe, were consecrated by Him assenting that,
what was made, was good), washes himself, and puts on the other
tunic—a holy-of-holies one, so to speak—which is to accompany him
into the adytum; exhibiting, as seems to me, the Levite and Gnostic,
as the chief of other priests (those bathed in water, and clothed in
faith alone, and expecting their own individual abode), himself
distinguishing the objects of the intellect from the things of sense,
rising above other priests, hasting to the entrance to the world of
ideas, to wash himself from the things here below, not in water, as
formerly one was cleansed on being enrolled in the tribe of Levi. But
purified already by the gnostic Word in his whole heart, and
thoroughly regulated, and having improved that mode of life
received from the priest to the highest pitch, being quite sanctified
both in word and life, and having put on the bright array of glory,
and received the ineffable inheritance of that spiritual and perfect
man, “which eye hath not seen and ear hath not heard, and it hath
not entered into the heart of man;” and having become son and
friend, he is now replenished with insatiable contemplation face to
face. For there is nothing like hearing the Word Himself, who by
means of the Scripture inspires fuller intelligence. For so it is said,
“And he shall put off the linen robe, which he had put on when he
entered into the holy place; and shall lay it aside there, and wash his
body in water in the holy place, and put on his robe.”[774] But in one
way, as I think, the Lord puts off and puts on by descending into the
region of sense; and in another, he who through Him has believed
puts off and puts on, as the apostle intimated, the consecrated stole.
Thence, after the image of the Lord, the worthiest were chosen from
the sacred tribes to be high priests, and those elected to the kingly
office and to prophecy were anointed.
CHAPTER VII.
THE EGYPTIAN SYMBOLS AND ENIGMAS OF SACRED THINGS.
Whence also the Egyptians did not entrust the mysteries they
possessed to all and sundry, and did not divulge the knowledge of
divine things to the profane; but only to those destined to ascend
the throne, and those of the priests that were judged the worthiest,
from their nurture, culture, and birth. Similar, then, to the Hebrew
enigmas in respect to concealment, are those of the Egyptians also.
Of the Egyptians, some show the sun on a ship, others on a
crocodile. And they signify hereby, that the sun, making a passage
through the delicious and moist air, generates time; which is
symbolized by the crocodile in some other sacerdotal account.
Further, at Diospolis in Egypt, on the temple called Pylon, there was
figured a boy as the symbol of production, and an old man as that of
decay. A hawk, on the other hand, was the symbol of God, as a fish
of hate; and, according to a different symbolism, the crocodile of
impudence. The whole symbol, then, when put together, appears to
teach this: “Oh ye who are born and die, God hates impudence.”
And there are those who fashion ears and eyes of costly material,
and consecrate them, dedicating them in the temples to the gods—
by this plainly indicating that God sees and hears all things. Besides,
the lion is with them the symbol of strength and prowess, as the ox
clearly is of the earth itself, and husbandry and food, and the horse
of fortitude and confidence; while, on the other hand, the sphinx, of
strength combined with intelligence—as it had a body entirely that of
a lion, and the face of a man. Similarly to these, to indicate
intelligence, and memory, and power, and art, a man is sculptured in
the temples. And in what is called among them the Komasiæ of the
gods, they carry about golden images—two dogs, one hawk, and
one ibis; and the four figures of the images they call four letters. For
the dogs are symbols of the two hemispheres, which, as it were, go
round and keep watch; the hawk, of the sun, for it is fiery and
destructive (so they attribute pestilential diseases to the sun); the
ibis, of the moon, likening the shady parts to that which is dark in
plumage, and the luminous to the light. And some will have it that
by the dogs are meant the tropics, which guard and watch the sun’s
passage to the south and north. The hawk signifies the equinoctial
line, which is high and parched with heat, as the ibis the ecliptic. For
the ibis seems, above other animals, to have furnished to the
Egyptians the first rudiments of the invention of number and
measure, as the oblique line did of circles.
CHAPTER VIII.
THE USE OF THE SYMBOLIC STYLE BY POETS AND PHILOSOPHERS.
But it was not only the most highly intellectual of the Egyptians,
but also such of other barbarians as prosecuted philosophy, that
affected the symbolical style. They say, then, that Idanthuris king of
the Scythians, as Pherecydes of Syros relates, sent to Darius, on his
passing the Ister in threat of war, a symbol, instead of a letter,
consisting of a mouse, a frog, a bird, a javelin, a plough. And there
being a doubt in reference to them, as was to be expected,
Orontopagas the Chiliarch said that they were to resign the
kingdom; taking dwellings to be meant by the mouse, waters by the
frog, air by the bird, land by the plough, arms by the javelin. But
Xiphodres interpreted the contrary; for he said, “If we do not take
our flight like birds, or like mice get below the earth, or like frogs
beneath the water, we shall not escape their arrows; for we are not
lords of the territory.”
It is said that Anacharsis the Scythian, while asleep, held his
secret parts with his left hand, and his mouth with his right, to
intimate that both ought to be mastered, but that it was a greater
thing to master the tongue than voluptuousness.
And why should I linger over the barbarians, when I can adduce
the Greeks as exceedingly addicted to the use of the method of
concealment? Androcydes the Pythagorean says the far-famed so-
called Ephesian letters were of the class of symbols. For he said that
ἄσκιον (shadowless) meant darkness, for it has no shadow; and
κατάσκιον (shadowy) light, since it casts with its rays the shadow;
and λίξ is the earth, according to an ancient appellation; and τετράς
is the year, in reference to the seasons; and δαμναμενεύς is the sun,
which overpowers (δαμάζων); and τὰ αἴσια is the true voice. And
then the symbol intimates that divine things have been arranged in
harmonious order—darkness to light, the sun to the year, and the
earth to nature’s processes of production of every sort. Also
Dionysius Thrax, the grammarian, in his book, Respecting the
Exposition of the Symbolical Signification in Circles, says expressly,
“Some signified actions not by words only, but also by symbols: by
words, as is the case of what are called the Delphic maxims,
‘Nothing in excess,’ ‘Know thyself,’ and the like; and by symbols, as
the wheel that is turned in the temples of the gods, derived from the
Egyptians, and the branches that are given to the worshippers. For
the Thracian Orpheus says:
“Whatever works of branches are a care to men on earth,
Not one has one fate in the mind, but all things
Revolve around; and it is not lawful to stand at one point,
But each one keeps an equal part of the race as they began.”
The branches either stand as the symbol of the first food, or they
are that the multitude may know that fruits spring and grow
universally, remaining a very long time; but that the duration of life
allotted to themselves is brief. And it is on this account that they will
have it that the branches are given; and perhaps also that they may
know, that as these, on the other hand, are burned, so also they
themselves speedily leave this life, and will become fuel for fire.
Very useful, then, is the mode of symbolic interpretation for many
purposes; and it is helpful to the right theology, and to piety, and to
the display of intelligence, and the practice of brevity, and the
exhibition of wisdom. “For the use of symbolical speech is
characteristic of the wise man,” appositely remarks the grammarian
Didymus, “and the explanation of what is signified by it.” And indeed
the most elementary instruction of children embraces the
interpretation of the four elements; for it is said that the Phrygians
call water Bedu, as also Orpheus says:
“And bright water is poured down, the Bedu of the nymphs.”
“Parent of the Ignetes and the Telchines briny Zaps was born.”[775]
“But come now, first will I speak of the Sun, the first principle of all things,
From which all, that we look upon, has sprung,
Both earth, and billowy deep, and humid air;
Titan and Ether too, which binds all things around.”
For a whole burnt-offering and rare sacrifice for us is Christ. And that
unwittingly he mentions the Saviour, he will make plain, as he adds:
“For thou who, ’midst the heavenly gods,
Jove’s sceptre sway’st, dost also share
The rule of those on earth.”
It is not then without reason that in the mysteries that obtain among
the Greeks, lustrations hold the first place; as also the laver among
the Barbarians. After these are the minor mysteries, which have
some foundation of instruction and of preliminary preparation for
what is to come after; and the great mysteries, in which nothing
remains to be learned of the universe, but only to contemplate and
comprehend nature and things.
We shall understand the mode of purification by confession, and
that of contemplation by analysis, advancing by analysis to the first
notion, beginning with the properties underlying it; abstracting from
the body its physical properties, taking away the dimension of depth,
then that of breadth, and then that of length. For the point which
remains is a unit, so to speak, having position; from which if we
abstract position, there is the conception of unity.
If, then, abstracting all that belongs to bodies and things called
incorporeal, we cast ourselves into the greatness of Christ, and
thence advance into immensity by holiness, we may reach somehow
to the conception of the Almighty, knowing not what He is, but what
He is not. And form and motion, or standing, or a throne, or place,
or right hand or left, are not at all to be conceived as belonging to
the Father of the universe, although it is so written. But what each
of these means will be shown in its proper place. The First Cause is
not then in space, but above both space, and time, and name, and
conception.
Wherefore also Moses says, “Show thyself to me”[805]—intimating
most clearly that God is not capable of being taught by man, or
expressed in speech, but to be known only by His own power. For
inquiry was obscure and dim; but the grace of knowledge is from
Him by the Son. Most clearly Solomon shall testify to us, speaking
thus: “The prudence of man is not in me: but God giveth me
wisdom, and I know holy things.”[806] Now Moses, describing
allegorically the divine prudence, called it the tree of life planted in
Paradise; which Paradise may be the world in which all things
proceeding from creation grow. In it also the Word blossomed and
bore fruit, being “made flesh,” and gave life to those “who had
tasted of His graciousness;” since it was not without the wood of the
tree that He came to our knowledge. For our life was hung on it, in
order that we might believe. And Solomon again says: “She is a tree
of immortality to those who take hold of her.”[807] “Behold, I set
before thy face life and death, to love the Lord thy God, and to walk
in His ways, and hear His voice, and trust in life. But if ye transgress
the statutes and the judgments which I have given you, ye shall be
destroyed with destruction. For this is life, and the length of thy
days, to love the Lord thy God.”[808]
Again: “Abraham, when he came to the place which God told him
of on the third day, looking up, saw the place afar off.”[809] For the
first day is that which is constituted by the sight of good things; and
the second is the soul’s[810] best desire; on the third, the mind
perceives spiritual things, the eyes of the understanding being
opened by the Teacher who rose on the third day. The three days
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.
textbookfull.com