tag:blogger.com,1999:blog-62376873275571769742024-02-06T20:10:44.794-08:00All CAD Services Private Limited Allcad Serviceshttp://www.blogger.com/profile/12867861373206421561noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-6237687327557176974.post-10113541489885042142017-10-30T23:43:00.000-07:002017-10-30T23:43:10.152-07:00Live Project Training on .Net,Java,Angular & React Native for B.Tech/BCA/MCA Students with 10% off<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="color: #656565; font-size: 10.5pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Software development is more than
just coding. Before you write even a single line of code, it requires careful
Analysis of the requirements, gathering information, preparing the necessary
documentation which requires understanding the requirements using Software
Development Life Cycle. And that’s just the beginning. Success of the project
will depend on how we decide to tackle the complexity of the real time project,
the choice of technology, the type of architecture etc.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: 21.0pt; margin-bottom: 7.5pt; margin-left: 0in; margin-right: 0in; margin-top: 3.75pt; mso-outline-level: 3;">
<span style="color: #2b73c6; font-size: 15.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">A. .net Training and Technology<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 7.5pt;">
<span style="color: #656565; font-size: 10.5pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Best Dot Net Training’s online .NET Live Project Training will help you to experience
the complete project life cycle using SDLC. The content to this course has been
developed by AllCAD Experts whom have hands on experience in both software
development as well as training.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 7.5pt;">
<span style="color: #656565; font-size: 10.5pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Through this .NET live project course we teach you how to apply
following concepts in one single project and develop a solution to a given
problem from ground up.<o:p></o:p></span></div>
<ol start="1" type="1">
<li class="MsoNormal" style="background: white; color: #656565; line-height: normal; mso-list: l4 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 10.5pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Object Orientation Principles<o:p></o:p></span></li>
<li class="MsoNormal" style="background: white; color: #656565; line-height: normal; mso-list: l4 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 10.5pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Handling Stored Procedures and other
database operations using LINQ<o:p></o:p></span></li>
<li class="MsoNormal" style="background: white; color: #656565; line-height: normal; mso-list: l4 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 10.5pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Security (Forms Authentication)<o:p></o:p></span></li>
<li class="MsoNormal" style="background: white; color: #656565; line-height: normal; mso-list: l4 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 10.5pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">State Management using Cookies and
Sessions<o:p></o:p></span></li>
<li class="MsoNormal" style="background: white; color: #656565; line-height: normal; mso-list: l4 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 10.5pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Master Pages User Controls<o:p></o:p></span></li>
<li class="MsoNormal" style="background: white; color: #656565; line-height: normal; mso-list: l4 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 10.5pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Payment Gateway integration<o:p></o:p></span></li>
</ol>
<div class="MsoNormal" style="background: white; line-height: 21.0pt; margin-bottom: 7.5pt; margin-left: 0in; margin-right: 0in; margin-top: 3.75pt; mso-outline-level: 3;">
<span style="color: #2b73c6; font-size: 15.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">B. Angular Training and Technology<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-size: 11.5pt;">Scope is at the heart of the AngularJS
data-binding story, weaving together the controller (JavaScript) and the view
(HTML) of a web application. The digest cycle is the scope's monitor, which
watches for changes and updates the view. The way you edit the scope and call
the digest cycle—using functions such as watch (), digest (), and apply ()—can
make a huge difference in the reliability and performance of large
applications. Companies are looking for AngularJS developers who can
understand, execute, and troubleshoot these functions. </span><span style="font-size: 10.5pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-size: 11.5pt;">This advanced AngularJS course helps
you explore the connected worlds of scope and the digest cycle.
Instructor Bar explains scope and inheritance, goes behind the scenes of
the digest loop, and teaches both manual and automatic data binding approaches.
Plus, learn how to integrate external libraries, diagnose performance issues,
and debug your applications.</span><span style="font-size: 10.5pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-size: 11.5pt;">Topics include:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 18.75pt; margin-right: 0in; margin-top: 0in; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; font-size: 10pt;">·<span style="font-family: "Times New Roman"; font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;">
</span></span><!--[endif]--><span style="font-size: 11.5pt;">Scope and controllers<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 18.75pt; margin-right: 0in; margin-top: 0in; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; font-size: 10pt;">·<span style="font-family: "Times New Roman"; font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;">
</span></span><!--[endif]--><span style="font-size: 11.5pt;">Scope built-in variables and methods<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 18.75pt; margin-right: 0in; margin-top: 0in; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; font-size: 10pt;">·<span style="font-family: "Times New Roman"; font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;">
</span></span><!--[endif]--><span style="font-size: 11.5pt;">Scope prototype inheritance<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 18.75pt; margin-right: 0in; margin-top: 0in; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; font-size: 10pt;">·<span style="font-family: "Times New Roman"; font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;">
</span></span><!--[endif]--><span style="font-size: 11.5pt;">Manual data binding with scope, Watch<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 18.75pt; margin-right: 0in; margin-top: 0in; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; font-size: 10pt;">·<span style="font-family: "Times New Roman"; font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;">
</span></span><!--[endif]--><span style="font-size: 11.5pt;">The digest loop<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 18.75pt; margin-right: 0in; margin-top: 0in; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; font-size: 10pt;">·<span style="font-family: "Times New Roman"; font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;">
</span></span><!--[endif]--><span style="font-size: 11.5pt;">Get the scope in the console<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 18.75pt; margin-right: 0in; margin-top: 0in; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; font-size: 10pt;">·<span style="font-family: "Times New Roman"; font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;">
</span></span><!--[endif]--><span style="font-size: 11.5pt;">Forcing digest<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 21.0pt; margin-bottom: 7.5pt; margin-left: 0in; margin-right: 0in; margin-top: 3.75pt; mso-outline-level: 3;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: 21.0pt; margin-bottom: 7.5pt; margin-left: 0in; margin-right: 0in; margin-top: 3.75pt; mso-outline-level: 3;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: 21.0pt; margin-bottom: 7.5pt; margin-left: 0in; margin-right: 0in; margin-top: 3.75pt; mso-outline-level: 3;">
<span style="color: #2b73c6; font-size: 15.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">C. React Native Training and Technology<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #FAFAF9; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="color: #111111; font-size: 13.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">From the creator of Build Web Apps
with React and Flux (the most popular and best reviewed course on React hosted
on Udemy), comes Go Mobile with React Native.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #FAFAF9; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="color: #111111; font-size: 13.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">If you're tired of spinning your
wheels learning Swift or Android, this is the course for you.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #FAFAF9; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="color: #111111; font-size: 13.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">This course will get you up and
running quickly, and teach you the core knowledge you need to deeply understand
and build React components for mobile devices.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #FAFAF9; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="color: #111111; font-size: 13.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">We'll start by mastering the
fundamentals of React, including JSX, “props", “state", and venting.
Source code is provided for each lecture, so you will always stay up-to-date
with the course pacing.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #FAFAF9; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="color: #111111; font-size: 13.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">If you are new to React, or if you've
been working to learn it but sometimes feel like you still don't quite 'get
it', this is the React course for you! To learn React you have to understand
it.<o:p></o:p></span></div>
<ul type="disc">
<li class="MsoNormal" style="background: #FAFAF9; color: #111111; line-height: normal; mso-list: l3 level1 lfo3; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 13.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Learn how to use React's custom markup
language, JSX, to clean up your Javascript code.<o:p></o:p></span></li>
<li class="MsoNormal" style="background: #FAFAF9; color: #111111; line-height: normal; mso-list: l3 level1 lfo3; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 13.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Learn the process of converting JSX to
raw Javascript on the fly in your browser.<o:p></o:p></span></li>
<li class="MsoNormal" style="background: #FAFAF9; color: #111111; line-height: normal; mso-list: l3 level1 lfo3; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 13.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Master the process of breaking down a
complex component into many smaller, interchangeable components.<o:p></o:p></span></li>
<li class="MsoNormal" style="background: #FAFAF9; color: #111111; line-height: normal; mso-list: l3 level1 lfo3; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 13.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Grasp the difference between
“props" and “state" and when to use each.<o:p></o:p></span></li>
<li class="MsoNormal" style="background: #FAFAF9; color: #111111; line-height: normal; mso-list: l3 level1 lfo3; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 13.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Develop apps that are unique, fun, and
responsive.<o:p></o:p></span></li>
<li class="MsoNormal" style="background: #FAFAF9; color: #111111; line-height: normal; mso-list: l3 level1 lfo3; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 13.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Build on both Android and iOS
platforms<o:p></o:p></span></li>
<li class="MsoNormal" style="background: #FAFAF9; color: #111111; line-height: normal; mso-list: l3 level1 lfo3; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 13.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Master integration with Parse for user
authentication<o:p></o:p></span></li>
<li class="MsoNormal" style="background: #FAFAF9; color: #111111; line-height: normal; mso-list: l3 level1 lfo3; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 13.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Learn the core principles of
navigation with React Native<o:p></o:p></span></li>
<li class="MsoNormal" style="background: #FAFAF9; color: #111111; line-height: normal; mso-list: l3 level1 lfo3; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 13.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">I've built the course that I would
have wanted to take when I was learning React Native. A course that explains
the concepts and how they're implemented in the best order for you to
learn and deeply understand them.<o:p></o:p></span></li>
</ul>
<div class="MsoNormal" style="background: #FAFAF9; line-height: normal; margin-bottom: 27.95pt; margin-left: 0in; margin-right: 0in; margin-top: 27.95pt; mso-outline-level: 6;">
<span style="color: #111111; font-size: 10.5pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri; text-transform: uppercase;">WHAT AM I GOING TO GET FROM THIS
COURSE?<b><o:p></o:p></b></span></div>
<ul type="disc">
<li class="MsoNormal" style="background: #FAFAF9; color: #111111; line-height: normal; mso-list: l2 level1 lfo4; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 13.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Build mobile apps for iOS using React
Native<o:p></o:p></span></li>
<li class="MsoNormal" style="background: #FAFAF9; color: #111111; line-height: normal; mso-list: l2 level1 lfo4; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 13.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Prototype and deploy your own
applications to the Apple Store<o:p></o:p></span></li>
<li class="MsoNormal" style="background: #FAFAF9; color: #111111; line-height: normal; mso-list: l2 level1 lfo4; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 13.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Get up to speed with React design
principles and methodologies<o:p></o:p></span></li>
<li class="MsoNormal" style="background: #FAFAF9; color: #111111; line-height: normal; mso-list: l2 level1 lfo4; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 13.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Learn the differences between using
React in a browser and on a mobile device<o:p></o:p></span></li>
<li class="MsoNormal" style="background: #FAFAF9; color: #111111; line-height: normal; mso-list: l2 level1 lfo4; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 13.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Discover mobile design patterns used
by experienced engineers<o:p></o:p></span></li>
</ul>
<div class="MsoNormal" style="background: white; line-height: 21.0pt; margin-bottom: 7.5pt; margin-left: 0in; margin-right: 0in; margin-top: 3.75pt; mso-outline-level: 3;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: 21.0pt; margin-bottom: 7.5pt; margin-left: 0in; margin-right: 0in; margin-top: 3.75pt; mso-outline-level: 3;">
<span style="color: #2b73c6; font-size: 15.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">D. Java Training and Technology<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="color: #666666; font-size: 11.5pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Java is an object-oriented language
that enables learners to create real-world applications. Java technology based
software works just about everywhere—from the smallest devices to super
computers! Java technology components are not impacted by the kind of computer,
phone, smart device or operating systems they are running on. The
architecture-neutral nature of Java technology is important in a networked
world where one cannot predict the kind of devices that partners, suppliers and
employees use to connect to their organizations.</span><span style="font-size: 10.5pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 21.0pt; margin-bottom: 7.5pt; margin-left: 0in; margin-right: 0in; margin-top: 3.75pt; mso-outline-level: 3;">
<span style="color: #2b73c6; font-size: 15.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">The course will allow learners to<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<br /></div>
<ul type="circle">
<li class="MsoNormal" style="background: white; color: #656565; line-height: 15.0pt; mso-list: l0 level1 lfo5; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 10.5pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Understand and document complete
requirements of the project as per the industry.<o:p></o:p></span></li>
<li class="MsoNormal" style="background: white; color: #656565; line-height: 15.0pt; mso-list: l0 level1 lfo5; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 10.5pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Create database schema including
Tables, Constraints and Stored Procedures.<o:p></o:p></span></li>
<li class="MsoNormal" style="background: white; color: #656565; line-height: 15.0pt; mso-list: l0 level1 lfo5; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 10.5pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Develop Dynamic Web Applications using
ASP.NET and .NETCORE,Angular.Js,2,4, <o:p></o:p></span></li>
<li class="MsoNormal" style="background: white; color: #656565; line-height: 15.0pt; mso-list: l0 level1 lfo5; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 10.5pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Develop applications using N-Tier
architecture<o:p></o:p></span></li>
<li class="MsoNormal" style="background: white; color: #656565; line-height: 15.0pt; mso-list: l0 level1 lfo5; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 10.5pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Arial; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">You can get full confidence for facing
the interviews not just theory but also you can answer questions involving
implementation of project life cycle.<o:p></o:p></span></li>
</ul>
<br />
<div class="MsoNormal">
<br /></div>
</div>
Allcad Serviceshttp://www.blogger.com/profile/12867861373206421561noreply@blogger.com0tag:blogger.com,1999:blog-6237687327557176974.post-44400079859694524622017-02-17T02:25:00.000-08:002017-02-17T02:25:20.241-08:00What is Software Development and Its History<div dir="ltr" style="text-align: left;" trbidi="on">
<table border="0" cellspacing="5" style="font-family: verdana, arial, helvetica, sans-serif; width: 98%px;"><tbody>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="69%"><img height="357" src="https://www.thocp.net/software/pictures/softwarecycle3.gif" width="550" /></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="31%"><br /></td></tr>
</tbody></table>
<div align="center" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
AllCAD Services Private Limited </div>
<blockquote style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px;">
<blockquote>
<blockquote>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<br /></div>
</blockquote>
</blockquote>
</blockquote>
<h3 style="color: #ff6666; font-family: Arial, Helvetica, sans-serif; font-size: 18pt; font-weight: normal; line-height: normal;">
<a class="header3" href="https://www.blogger.com/null" name="FirstSteps" style="color: blue; font-size: 12pt;">First Steps</a></h3>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
This part will be different from the History of the computer, no chronological travel trough software-land, but a collection of articles and assays on software.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Software has a long history and as far as the facts are known to us we will give them to you. When missing stories, data, or other information are shared to us they will be put on this site. If you have any comments of suggestions regarding this page or any other page please do not hesitate to contact us.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
A simple question: "What is software?" A very simple answer is: Hardware you can touch, software you can't. But that is too simple indeed.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
But when talking about software you talk about programming and programming languages. But about producing and selling the products made by programming (languages) as well.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
There are over 300 different ("common") computer languages in existence, apart from the various dialects stemming from one of them. Most of them can be classified in definable groups, but others don’t belong to anything. Some because they are rather new or the use of them was or is never wide spread and only used by a small specialized professionals or groups of scientists requiring these dialects. This is often the case with a specific language that was designed for just one purpose, e.g. telecommunication or supercomputing.<br />Some languages are even dead languages, some others are revived and expanded upon again, and there are ones that constantly rejuvenate. In the latter case a programmer is sometimes wondering whether he or she is not just upgrading to a newer version but instead learning a complete new language.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<br /></div>
<h3 style="color: #ff6666; font-family: Arial, Helvetica, sans-serif; font-size: 18pt; font-weight: normal; line-height: normal;">
<a class="header3" href="https://www.blogger.com/null" name="How" style="color: blue; font-size: 12pt;">How It All Started</a></h3>
<div align="left" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<span>I</span>t shouldn't be a big surprise that the creation or software also went in large but distinguishable steps. Compared with hardware there were fewer developments that went parallel or overlapping. In rare cases developments were reinvented sometimes because the development or invention was not published, even prohibited to be made public (war, secrecy acts etc.) or became known at the same time and after (legal)discussions the "other" party won the honors.</div>
<div align="left" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
The earliest practical form of programming was probably done by Jaquard (1804, France). He designed a loom that performed predefined tasks through feeding punched cards into a reading contraption. This new technology allowed carpets and tissues to be manufactured with lower skills and even with fewer people. The little kid sitting under the loom changing rods and other things vanished. One single person could now handle a loom. That this met resistance from the weavers leaves no question. The same thing happened in England during the industrial revolution there. Even a movement came up called: Luddites (anti technology or just concerned citizens fighting for their bread?)</div>
<div align="center" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<img height="200" src="https://www.thocp.net/hardware/pictures/storage/jacquards_punchcards.gif" width="150" /><br /><span class="footer" style="color: #804040; font-family: Arial, Helvetica, sans-serif; font-size: 8pt;">This picture shows the manufacturing<br />of punched cards for looms</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1HkTqY-R9xW1xytoPK8oZ01w7Gt3NH5lfre5Wir2LGvph_7QgZRir9spPzvy5xm7m_01NjYfoFZIVH4QGabG86Q19zuBDNjtZ2COTFspiUu4J4sBu-AW4YDDG_mv-vTBBsNSCf8ZEavg/s1600/an-agile-development-primer-6-728.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1HkTqY-R9xW1xytoPK8oZ01w7Gt3NH5lfre5Wir2LGvph_7QgZRir9spPzvy5xm7m_01NjYfoFZIVH4QGabG86Q19zuBDNjtZ2COTFspiUu4J4sBu-AW4YDDG_mv-vTBBsNSCf8ZEavg/s320/an-agile-development-primer-6-728.jpg" width="320" /></a></div>
<div align="center" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<span class="footer" style="color: #804040; font-family: Arial, Helvetica, sans-serif; font-size: 8pt;"><br /></span></div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
The technology of punched cards will later be adapted by (IBM's) Recording and Tabulating Company to process data.</div>
<table bgcolor="#FFFFCC" border="0" cellpadding="5" cellspacing="0" style="font-family: verdana, arial, helvetica, sans-serif; width: 99%px;"><tbody>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" valign="top"><td bgcolor="#FFFFFF" rowspan="2" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="72%"><div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
The situation was still a one on one game: a problem needed to be solved thus a machine was built. (Pascal, Babbage, Scheultz & Son) And when some sort of instruction was needed a sequence was designed or written and transferred to either cards or mechanical aids such as wires, gears, shafts actuators etc.. To call that programming? Well, according to our definition yes it was.</div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
First there was <a href="https://www.thocp.net/biographies/lovelace_ada.html" style="background: transparent; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">Ada Lovelace</a>, writing a rudimentary program (1843) for the Analytical Machine, designed by <a href="https://www.thocp.net/biographies/babbage_charles.html" style="background: transparent; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">Charles Babbage</a> in 1827, but the machine never came into operation.</div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Then there was <a href="https://www.thocp.net/biographies/boole_george.html" style="background: transparent; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">George Boole</a> (1815-1864), a British mathematician, who proved the relation between mathematics and logic with his algebra of logic (<a href="https://www.blogger.com/null" name="BOOLEAN algebra" style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: 12pt;"></a>BOOLEAN algebra or <a href="https://www.blogger.com/null" name="binary logic" style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: 12pt;"></a>binary logic) in 1847.</div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
This meant a breakthrough for mathematics. Boole was the first to prove that logic is part of mathematics and not of philosophy.</div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
A big step in thinking too.</div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
But it will take <b>one hundred years</b> before this algebra of logic is put to work for computing.</div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
John Von Neumann working at the Institute for Advanced Study developed in <a href="https://www.thocp.net/timeline/1944.htm#1945" style="background: transparent; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">1945</a> two important concepts that directly affected the path of computer programming languages:</div>
<blockquote>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
The first concept became known as "shared-program technique" <a href="https://www.thocp.net/software/software_reference/introduction_to_software_history.htm#7" style="background: transparent; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">(7)</a>. This technique states that the actual computer hardware should be simple and not need to be hand-wired for each program. Instead, complex instructions should be used to control the simple hardware, allowing it to be reprogrammed much faster.<a href="https://www.thocp.net/software/software_reference/introduction_to_software_history.htm#8" style="background: transparent; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">(8)</a><br />The second concept was also extremely important to the development of programming languages. Von Neumann called it "conditional control transfer"<a href="https://www.thocp.net/software/software_reference/introduction_to_software_history.htm#7" style="background: transparent; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">(7)</a> (www.softlord.com). This idea gave rise to the notion of subroutines, or small blocks of code that could be jumped to in any order, instead of a single set of chronologically ordered steps for the computer to take. The second part of the idea stated that computer code should be able to branch based on logical statements such as IF (expression) THEN, and looped such as with a FOR statement. "Conditional control transfer" gave rise to the idea of "libraries," which are blocks of code that can be reused over and over.<a href="https://www.thocp.net/software/software_reference/introduction_to_software_history.htm#8" style="background: transparent; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">(8)</a></div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<em>the first draft on the EDVAC</em> <a href="https://www.thocp.net/biographies/papers/firstdraft_edvac_neumann.pdf" style="background: transparent; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;"><img align="texttop" alt="first draft on edvac" border="0" height="40" src="https://www.thocp.net/images/detailbutton.gif" width="40" /></a></div>
</blockquote>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<br /></div>
</td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="28%"><div align="left" style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<span style="font-size: x-small;">"<b>What was first: software or hardware</b>"</span></div>
<div align="left" style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<span class="footer" style="color: #804040; font-family: Arial, Helvetica, sans-serif; font-size: 8pt;">Frankly this is a matter of philosophy, or simpler: how you look at it.</span></div>
<div align="left" class="footer" style="color: #804040; font-family: Arial, Helvetica, sans-serif; font-size: 8pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Nonetheless this question is difficult to answer:</div>
<div align="left" class="footer" style="color: #804040; font-family: Arial, Helvetica, sans-serif; font-size: 8pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
With the early computers "the idea" did not express itself neither in software nor in just hardware but was broadly interpreted: computing was problem based.<br />Remember that the first computers were designed for just one single task. One problem - one computer or machine or contraption.</div>
<div align="left" class="footer" style="color: #804040; font-family: Arial, Helvetica, sans-serif; font-size: 8pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
The autonomous - something that could theoretically "run" by itself on any machine - software idea came only after these single task computers were already history.</div>
<div align="left" class="footer" style="color: #804040; font-family: Arial, Helvetica, sans-serif; font-size: 8pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
That is why can be said:</div>
<div align="left" class="footer" style="color: #804040; font-family: Arial, Helvetica, sans-serif; font-size: 8pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<span style="color: #660000;">The first computers that were built, represented in the same time the software as well as the hardware</span><br /><br />More precise: one could build a machine to have it solve a problem automatically. By doing that you translated an idea into a mechanical expression that ran the built in problemsolving mechanism by itself.</div>
<div align="left" class="footer" style="color: #804040; font-family: Arial, Helvetica, sans-serif; font-size: 8pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
So this question can not be answered when you regard software as a non integrated standalone idea or resource. In that case: hardware was first.</div>
<div align="left" class="footer" style="color: #804040; font-family: Arial, Helvetica, sans-serif; font-size: 8pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
But for the hardware to run you needed an idea or problem to be translated into a mechanical expression. In other words software solidified into a machine. In this case software was first.</div>
</td></tr>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" valign="top"><td bgcolor="#FFFFFF" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="28%"> </td></tr>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" valign="top"><td bgcolor="#FFFFFF" colspan="2" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><blockquote>
<div class="sm" style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
(the following paragraphs are cited from http://www.princeton.edu/~ferguson/adw/programming_languages.shtml)</div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
It took <a href="https://www.thocp.net/biographies/shannon_claude.htm" style="background: transparent; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">Claude Shannon</a> (1916-2001) who wrote a thesis (<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><i><a href="https://www.thocp.net/biographies/papers/shannon_1948.pdf" style="background: transparent; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">A Mathematical Theory of Communication</a></i><a href="https://www.thocp.net/biographies/papers/shannon_1948.pdf" style="background: transparent; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;"> in the <i>Bell System Technical Journal</i> -1948</a>)</span> on how binary logic could be used in computing to complete the software concept of modern computing.</div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
In 1949, a few years after Von Neumann's work, the language Short Code appeared . It was the first computer language for electronic devices and it required the programmer to change its statements into 0's and 1's by hand. Still, it was the first step towards the complex languages of today. In 1951, Grace Hopper wrote the first compiler, A-0. A compiler is a program that turns the language's statements into 0's and 1's for the computer to understand. This lead to faster programming, as the programmer no longer had to do the work by hand.<a href="https://www.thocp.net/software/software_reference/introduction_to_software_history.htm#9" style="background: transparent; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">(9)</a></div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
In 1957, the first of the major languages appeared in the form of FORTRAN. Its name stands for FORmula TRANslating system. The language was designed at IBM for scientific computing. The components were very simple, and provided the programmer with low-level access to the computers innards. Today, this language would be considered restrictive as it only included IF, DO, and GOTO statements, but at the time, these commands were a big step forward. The basic types of data in use today got their start in FORTRAN, these included logical variables (TRUE or FALSE), and integer, real, and double-precision numbers.<br /><br />Though FORTAN was good at handling numbers, it was not so good at handling input and output, which mattered most to business computing. Business computing started to take off in 1959, and because of this, COBOL was developed. It was designed from the ground up as the language for businessmen. Its only data types were numbers and strings of text. It also allowed for these to be grouped into arrays and records, so that data could be tracked and organized better. It is interesting to note that a COBOL program is built in a way similar to an essay, with four or five major sections that build into an elegant whole. COBOL statements also have a very English-like grammar, making it quite easy to learn. All of these features were designed to make it easier for the average business to learn and adopt it.<br /><br />In 1958, John McCarthy of MIT created the LISt Processing (or LISP) language. It was designed for Artificial Intelligence (AI) research. Because it was designed for such a highly specialized field, its syntax has rarely been seen before or since. The most obvious difference between this language and other languages is that the basic and only type of data is the list, denoted by a sequence of items enclosed by parentheses. LISP programs themselves are written as a set of lists, so that LISP has the unique ability to modify itself, and hence grow on its own. The LISP syntax was known as "Cambridge Polish," as it was very different from standard Boolean logic (Wexelblat, 177) :</div>
<center>
<table><tbody>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">x V y - Cambridge Polish, what was used to describe the LISP program<br />OR(x,y) - parenthesized prefix notation, what was used in the LISP program<br />x OR y - standard Boolean logic</td></tr>
</tbody></table>
</center>
LISP remains in use today because its highly specialized and abstract nature.<br /><br />The Algol language was created by a committee for scientific use in 1958. It's major contribution is being the root of the tree that has led to such languages as Pascal, C, C++, and Java. It was also the first language with a formal grammar, known as Backus-Naar Form or BNF (<em>McGraw-Hill Encyclopedia of Science and Technology</em>, 454). Though Algol implemented some novel concepts, such as recursive calling of functions, the next version of the language, Algol 68, became bloated and difficult to use (www.byte.com). This lead to the adoption of smaller and more compact languages, such as Pascal.<br /><br />Pascal was begun in 1968 by Niklaus Wirth. Its development was mainly out of necessity for a good teaching tool. In the beginning, the language designers had no hopes for it to enjoy widespread adoption. Instead, they concentrated on developing good tools for teaching such as a debugger and editing system and support for common early microprocessor machines which were in use in teaching institutions.<br /><br />Pascal was designed in a very orderly approach, it combined many of the best features of the languages in use at the time, COBOL, FORTRAN, and ALGOL. While doing so, many of the irregularities and oddball statements of these languages were cleaned up, which helped it gain users (Bergin, 100-101). The combination of features, input/output <em>and</em> solid mathematical features, made it a highly successful language. Pascal also improved the "pointer" data type, a very powerful feature of any language that implements it. It also added a CASE statement, that allowed instructions to to branch like a tree in such a manner:<br /><center>
<table><tbody>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">CASE <em>expression</em> OF<br /> <em>possible-expression-value-1</em>:<br /> <em>statements to execute</em>...<br /> <em>possible-expression-value-2</em>:<br /> <em>statements to execute</em>...<br />END</td></tr>
</tbody></table>
</center>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Pascal also helped the development of dynamic variables, which could be created while a program was being run, through the NEW and DISPOSE commands. However, Pascal did not implement dynamic arrays, or groups of variables, which proved to be needed and led to its downfall (Bergin, 101-102). Wirth later created a successor to Pascal, Modula-2, but by the time it appeared, C was gaining popularity and users at a rapid pace.<br /><br />C was developed in 1972 by Dennis Ritchie while working at Bell Labs in New Jersey. The transition in usage from the first major languages to the major languages of today occurred with the transition between Pascal and C. Its direct ancestors are B and BCPL, but its similarities to Pascal are quite obvious. All of the features of Pascal, including the new ones such as the CASE statement are available in C. C uses pointers extensively and was built to be fast and powerful at the expense of being hard to read. But because it fixed most of the mistakes Pascal had, it won over former-Pascal users quite rapidly.<br />Ritchie developed C for the new Unix system being created at the same time. Because of this, C and Unix go hand in hand. Unix gives C such advanced features as dynamic variables, multitasking, interrupt handling, forking, and strong, low-level, input-output. Because of this, C is very commonly used to program operating systems such as Unix, Windows, the MacOS, and Linux.<br /><br /> In the late 1970's and early 1980's, a new programing method was being developed. It was known as Object Oriented Programming, or OOP. Objects are pieces of data that can be packaged and manipulated by the programmer. Bjarne Stroustroup liked this method and developed extensions to C known as "C With Classes." This set of extensions developed into the full-featured language C++, which was released in 1983.<br /><br />C++ was designed to organize the raw power of C using OOP, but maintain the speed of C and be able to run on many different types of computers. C++ is most often used in simulations, such as games. C++ provides an elegant way to track and manipulate hundreds of instances of people in elevators, or armies filled with different types of soldiers. It is the language of choice in today's AP Computer Science courses.<br /><br />In the early 1990's, interactive TV was the technology of the future. Sun Microsystems decided that interactive TV needed a special, portable (can run on many types of machines), language. This language eventually became Java. In 1994, the Java project team changed their focus to the web, which was becoming "the cool thing" after interactive TV failed. The next year, Netscape licensed Java for use in their internet browser, Navigator. At this point, Java became the language of the future and several companies announced applications which would be written in Java, none of which came into use.<br /><br />Though Java has very lofty goals and is a text-book example of a good language, it may be the "language that wasn't". It has serious optimization problems, meaning that programs written in it run very slowly. And Sun has hurt Java's acceptance by engaging in political battles over it with Microsoft. But Java may wind up as the instructional language of tomorrow as it is truly object-oriented and implements advanced techniques such as true portability of code and garbage collection.<br /><br />Visual Basic is often taught as a first programming language today as it is based on the BASIC language developed in 1964 by John Kemeny and Thomas Kurtz. BASIC is a very limited language and was designed for non-computer science people. Statements are chiefly run sequentially, but program control can change based on IF..THEN, and GOSUB statements which execute a certain block of code and then return to the original point in the program's flow.<br /><br />Microsoft has extended BASIC in its Visual Basic (VB) product. The heart of VB is the form, or blank window on which you drag and drop components such as menus, pictures, and slider bars. These items are known as "widgets." Widgets have properties (such as its color) and events (such as clicks and double-clicks) and are central to building any user interface today in any language. VB is most often used today to create quick and simple interfaces to other Microsoft products such as Excel and Access without needing a lot of code, though it is possible to create full applications with it.<br /><br />Perl has often been described as the "duct tape of the Internet," because it is most often used as the engine for a web interface or in scripts that modify configuration files. It has very strong text matching functions which make it ideal for these tasks. Perl was developed by Larry Wall in 1987 because the Unix sed and awk tools (used for text manipulation) were no longer strong enough to support his needs. Depending on whom you ask, Perl stands for Practical Extraction and Reporting Language or Pathologically Eclectic Rubbish Lister.<br /><br />Programming languages have been under development for years and will remain so for many years to come. They got their start with a list of steps to wire a computer to perform a task. These steps eventually found their way into software and began to acquire newer and better features. The first major languages were characterized by the simple fact that they were intended for one purpose and one purpose only, while the languages of today are differentiated by the way they are programmed in, as they can be used for almost any purpose. And perhaps the languages of tomorrow will be more natural with the invention of quantum and biological computers.<br /><em><end quote></em> </div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Also the hardware needed to make jumps ahead like the folowing:</div>
<ul>
<li>It took Zuse to create the first binary programmable computer, relay based.</li>
<li>The Bomba, originally built by Polish engineers to crack the Enigma code, pushed the envelop again</li>
<li>The colossus built by people from Bletchley Park (near London, UK) for the same purpose</li>
<li>Atanasov and Berry designed the ABC computer, a binary computer, as Zuse's was, but now 100% electronic.</li>
<li>And not to forget the ENIAC by Eckert and Mauchly and a team made up of many others</li>
</ul>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Now things were in place to start off with the information age.</div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<br /></div>
</blockquote>
<center>
<h3 style="color: #ff6666; font-family: Arial, Helvetica, sans-serif; font-size: 18pt; font-weight: normal; line-height: normal;">
</h3>
</center>
</td></tr>
</tbody></table>
<h3 align="left" style="color: #ff6666; font-family: Arial, Helvetica, sans-serif; font-size: 18pt; font-weight: normal; line-height: normal;">
<a href="https://www.blogger.com/null" name="infoage" style="color: blue; font-size: 12pt;"></a>Enter the Information Age</h3>
<div align="left" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
In the beginning of the so called "Information Age" computers were programmed by "programming" direct instructions into it. This was done by setting switches or making connections to different logical units by wires (circuitry).</div>
<div align="center" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<img height="375" src="https://www.thocp.net/hardware/pictures/eniac_programming.jpg" width="368" /><a href="https://www.thocp.net/software/software_reference/introduction_to_software_history.htm#1" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">(1)</a><br /><span class="footer" style="color: #804040; font-family: Arial, Helvetica, sans-serif; font-size: 8pt;">Two women wiring the right side of the ENIAC with a new program<br />(US Army photo, from archives of the ARL Technical library, courtesy of Mike Muuss)</span></div>
<div align="left" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Programming like this was nothing else but rewiring these huge machines in order to use all the options, possibilities and calculations. Reprogramming always meant rewiring.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
In that way calculations needed days of preparations, handling thousands of wires, resetting switches, plugs etc. (in the most extreme case that is). And the programmed calculation itself just took a few minutes. If the "programming" of wiring did not have a wrong connection, the word bug was not in used yet, for programming errors.<br />The coding panels very much looked like that a few telephone switchboards hustled together, and in fact many parts actually came from switch boards.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
With the invention of vacuum tubes, along with many other inventions, much of the rewiring belonged to the past. The tubes replaced the slow machines based on relays.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<br /></div>
<table align="center" border="0" cellpadding="5" cellspacing="0" style="font-family: verdana, arial, helvetica, sans-serif; width: 75%px;"><tbody>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="43%"><div align="center" style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<img height="200" src="https://www.thocp.net/hardware/pictures/components/vacuum_tube_diode_small.jpg" width="150" /></div>
</td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="57%"><div align="center" style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<img height="150" src="https://www.thocp.net/hardware/pictures/components/transistor_thmp.gif" width="150" /></div>
</td></tr>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="43%"><div align="center" class="footer" style="color: #804040; font-family: Arial, Helvetica, sans-serif; font-size: 8pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
The above picture displays an early electronic switch called a triode.</div>
<div align="center" style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
</div>
</td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="57%"><div align="center" class="footer" style="color: #804040; font-family: Arial, Helvetica, sans-serif; font-size: 8pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
The first contactpoint transistor</div>
</td></tr>
</tbody></table>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
When the transistor was invented this again replaced a technology: vacuum tubes.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
When <a href="https://www.thocp.net/biographies/shannon_claude.htm" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">Shannon</a> reinvented or better rediscovered the <a href="https://www.thocp.net/sciences/mathematics/binairy_calculus.htm" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">binary calculus</a> in 1948 and indicated how that could be used for computing a revolution started. The race was on!</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<br /></div>
<div align="left" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<b><span style="color: #0066cc;"><a href="https://www.blogger.com/null" name="toys" style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: 12pt;"></a>Programming the new tools (or toys?)</span></b></div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Programming the first binary computer was still not an easy task and much prone to mistakes. First programming was done by typing in 1's or 0's that were stored on different information carriers. Like paper tapes, punched hole cards, hydrogen delay lines (sound or electric pulse) and later magnetic drums and much later magnetic and optical discs.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
By storing these 0's and 1's on a carrier (first used by <a href="https://www.thocp.net/timeline/1938.htm#suze" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">Karl Suze's X1</a> in <a href="https://www.thocp.net/timeline/1938.htm" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">1938</a>) it was possible to have the computer read the data on any later time. But mis typing a single zero or one meant a disaster because all coding (instructions) should absolutely be on the right place and in the right order in memory. This technology was called absolute addressing.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
An example:</div>
<div align="center" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
1010010101110101011</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
If this is a sequence for switches it means switch one on, switch two off etc. etc. </div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
In simple language:</div>
<div align="center" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<center>
<table border="1" cellspacing="0" style="width: 52%px;"><tbody>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td bgcolor="#008080" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="33%"><b><span style="color: white;">Panel</span></b></td><td align="center" bgcolor="#008080" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="12%"><b><span style="color: white;">1</span></b></td><td bgcolor="#008080" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="55%"><b><span style="color: white;">function: enter house</span></b></td></tr>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td bgcolor="#008080" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="33%"><b><span style="color: white;">Switch 0</span></b></td><td align="center" bgcolor="#008080" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="12%"><b><span style="color: white;">1</span></b></td><td bgcolor="#008080" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="55%"><b><span style="color: white;">open the door</span></b></td></tr>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td bgcolor="#008080" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="33%"><b><span style="color: white;">Switch 1</span></b></td><td align="center" bgcolor="#008080" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="12%"><b><span style="color: white;">1</span></b></td><td bgcolor="#008080" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="55%"><b><span style="color: white;">put the lights on</span></b></td></tr>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td bgcolor="#008080" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="33%"><b><span style="color: white;">Switch 2</span></b></td><td align="center" bgcolor="#008080" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="12%"><b><span style="color: white;">0</span></b></td><td bgcolor="#008080" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="55%"><b><span style="color: white;">close the door (please)</span></b></td></tr>
</tbody></table>
<div align="left" style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
In fact the protocols for programming the machines in this way looked very much like that.</div>
<div align="left" style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
In the early 50's programmers started to let the machines do a part of the job. This was called automatic coding and made live a lot easier for the early programmers.</div>
</center>
</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<br /></div>
<table align="right" bgcolor="#FFFFCC" border="0" cellpadding="5" cellspacing="0" style="font-family: verdana, arial, helvetica, sans-serif; width: 35%px;"><tbody>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><div class="footer" style="color: #804040; font-family: Arial, Helvetica, sans-serif; font-size: 8pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Absolute addressing:</div>
<div class="footer" style="color: #804040; font-family: Arial, Helvetica, sans-serif; font-size: 8pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
the programmer instructs the machine at what location of the memory (valve, relay, transistor) to store a value</div>
</td></tr>
</tbody></table>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Soon the next step was to have the program to select the proper memory address in stead of using absolute addressing.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
The next development was to combine groups of instruction into so called words and abbreviations were thought up called: opcodes (Hopper 1948)</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<br /></div>
<div align="left" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<b><span style="color: #0066cc;"><a href="https://www.blogger.com/null" name="machine" style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: 12pt;"></a>Machine Language</span></b></div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Opcode works like a shorthand and represents as said a group of machine instructions. The opcode is translated by another program into zero's and one's, something a machine could translate into instructions.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
But the relation is still one to one: one code to one single instruction. However very basically this is already a programming language. It was called: assembly language.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
An example:</div>
<table align="center" bgcolor="#008080" border="1" cellpadding="5" cellspacing="0" style="font-family: verdana, arial, helvetica, sans-serif; width: 421px;"><tbody>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="105"><span style="color: white;">Label</span></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="105"><span style="color: white;">Opcode</span></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="106"><span style="color: white;">Register</span></td></tr>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="105"><b><span style="color: white;">CALC:</span></b></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="105"><b><span style="color: white;">STO</span></b></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="106"><b><span style="color: white;">R1, HELP0</span></b></td></tr>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="105"><span style="color: white;"> </span></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="105"><b><span style="color: white;">STO</span></b></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="106"><b><span style="color: white;">R2, HELP2</span></b></td></tr>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="105"><span style="color: white;"> </span></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="105"><b><span style="color: white;">LD</span></b></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="106"><b><span style="color: white;">R3, HELP1</span></b></td></tr>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="105"><span style="color: white;"> </span></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="105"><b><span style="color: white;">ADD</span></b></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="106"><b><span style="color: white;">R3, HELP2</span></b></td></tr>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="105"><span style="color: white;"> </span></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="105"><b><span style="color: white;">LD</span></b></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="106"><b><span style="color: white;">R4, HELP1</span></b></td></tr>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="105"><span style="color: white;"> </span></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="105"><b><span style="color: white;">SUB</span></b></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="106"><b><span style="color: white;">R4, HELP2</span></b></td></tr>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="105"><span style="color: white;"> </span></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="105"><b><span style="color: white;">RSR</span></b></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="106"><b><span style="color: white;">SP, 0</span></b></td></tr>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="105"><b><span style="color: white;">HELP1:</span></b></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="105"><b><span style="color: white;">DS</span></b></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="106"><b><span style="color: white;">2</span></b></td></tr>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="105"><b><span style="color: white;">HELP2:</span></b></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="105"><b><span style="color: white;">DS</span></b></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="106"><b><span style="color: white;">2</span></b></td></tr>
</tbody></table>
<blockquote style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px;">
<blockquote>
<blockquote>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
</div>
</blockquote>
</blockquote>
</blockquote>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
This piece of assembly code calculates the difference between two numbers.</div>
<div align="left" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<br /></div>
<div align="left" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<b><span style="color: #0066cc;"><a href="https://www.blogger.com/null" name="subroutines" style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: 12pt;"></a>Subroutines</span></b></div>
<div align="left" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Soon after developing machine languages and the first crude programming languages began to appear the danger of inextricable and thus unreadable coding became apparent. Later this messy programming was called: "spaghetti code".<br />One important step in unraveling or preventing spaghetti code was the development of subroutines. And it needed <a href="https://www.thocp.net/software/biographies/wilkes_maurice.html" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">Maurice Wilkes</a>, when realizing that "a good part of the remainder of his life was going to be spent in finding errors in ... programs", to develop the concept of subroutines in programs to create reusable modules. Together with Stanley Gill and David Wheeler he produced the first textbook on "The Preparation of Programs for an Electronic Digital Computer".<a href="https://www.thocp.net/software/software_reference/introduction_to_software_history.htm#6" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">(6)</a><br />The formalized concept of software development (not named so for another decade) had its beginning in 1951.</div>
<div align="left" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Below is an example of how subroutines would work.</div>
<table align="center" bgcolor="#FFFFCC" border="1" bordercolor="#CECECE" cellpadding="5" cellspacing="0" style="font-family: verdana, arial, helvetica, sans-serif; width: 68%px;"><tbody>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td bgcolor="#FDF1EC" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" valign="top" width="40%"><div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Start of program</div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
the main "menu"</div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<br /></div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<br /></div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<br /></div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
first subroutine</div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<br /></div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
back to the main menu</div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
second subroutine</div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<i>with a parameter (contents of what to print)</i></div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<br /></div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<i><br /></i>back to procedure: main</div>
</td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" valign="top" width="60%"><div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Begin program;</div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<b><i>Main</i></b>;</div>
<blockquote>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<span style="color: #0000cc;">Printf ("Hello World");<br />DoSomethingElse()<br />Printf ("Hello World");</span></div>
</blockquote>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
(end of program)</div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Function <b>DoSomethingElse</b>;</div>
<blockquote>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<span style="color: #0000cc;">Add two numbers;</span></div>
</blockquote>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Return OK</div>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Function <i><b>Printf</b></i>(what_to_print)</div>
<blockquote>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<span style="color: #0000cc;">Open channel to printer interface;<br />Initialize printer;<br />Send "what_to_print" to printer;<br />Send page feed to printer;<br />Close printer interface;</span></div>
</blockquote>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Return OK</div>
</td></tr>
</tbody></table>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<br /></div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
This program would print "Hello World" twice on two different pages.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
By re-using the <b>Printf</b> subroutine a possible error in this routine would show up only once. An enormous advantage when looking for errors. Off course the <i>Open, Initialize, Send,</i> and <i>Close</i> "commands" in this <b>Printf</b> function are also subroutines.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<br /></div>
<div align="left" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<b><span style="color: #0066cc;"><a href="https://www.blogger.com/null" name="fortran" style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: 12pt;"></a>Fortran</span></b></div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
The next big step in programming began when an IBM team under <a href="https://www.blogger.com/null" name="fortran" style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: 12pt;"></a><a href="https://www.thocp.net/biographies/backus_john.htm" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">John W. Backus</a> created FORTRAN - FORmula TRANslator 1952. It could only be used on their own machine, the: IBM 704. But later versions for other machines, and platforms were sold soon after. Until long past 1960 different CPU's required an other kind instruction set to add a number, thus for each different machine a different <a href="https://www.thocp.net/software/software_reference/interpretescompilers" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">compiler</a> was needed. Typically the manual came years later in 1957!<br />Rewiring of machines to reprogram them now definitely belonged to the past!</div>
<div align="center" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<img border="1" height="266" src="https://www.thocp.net/software/pictures/fortran_frontpage_1957.gif" width="208" /></div>
<div align="left" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<b><span style="color: #0066cc;"><a href="https://www.blogger.com/null" name="language" style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: 12pt;"></a>Programming language</span></b></div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
FORTRAN soon became called a programming language. So why calling a set of some predefined instructions a programming language?</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Because some characteristics of a language are met:</div>
<ul style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px;">
<li>It must have a vocabulary - list of words</li>
<li>It must have a grammar - or syntax</li>
<li>It must be unique, both in words and in context</li>
</ul>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
All the above criteria were easily met for this - strictly defined- set of computer instructions.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
An example:</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Let's presume communication with a computer can be accomplished. Then how would you tell it to add two numbers in simple terms?</div>
<table align="center" bgcolor="#006666" border="1" cellpadding="3" cellspacing="0" style="font-family: verdana, arial, helvetica, sans-serif; width: 40%px;"><tbody>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><span style="color: white;">human</span></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><span style="color: white;">computer</span></td></tr>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><span style="color: white;">Add 2 and 2</span></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><span style="color: white;"> </span></td></tr>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><span style="color: white;">Show me the answer</span></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><span style="color: white;">print 2+2</span></td></tr>
</tbody></table>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Depending on what (dialect of) computer language you use it could look different:</div>
<table align="center" bgcolor="#006666" border="1" cellpadding="5" cellspacing="0" style="font-family: verdana, arial, helvetica, sans-serif; width: 56%px;"><tbody>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="43%"><span style="color: white;">human</span></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="57%"><span style="color: white;">computer</span></td></tr>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="43%"><span style="color: white;">Add 2 and 2</span></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="57%"><span style="color: white;">answer := 2+2;</span></td></tr>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="43%"><span style="color: white;">Show me the answer</span></td><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;" width="57%"><span style="color: white;">printf ("%d\n", answer);</span></td></tr>
</tbody></table>
<div align="center" class="footer" style="color: #804040; font-family: Arial, Helvetica, sans-serif; font-size: 8pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
The above example is standard ANSI C.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
And by the time when Cobol, Common Business Oriented Language, was published in 1960 by the Codasyl committee, (Hopper was a member) the term Computer Language was a fact.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
In the meantime hardware developments raced literally ahead.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Already computers were connected to teletype machines to expedite the entry of programs. In the late 1960's the first video interfaces were connected. The network was invented. And floppy disks, harddrives etc. made live for programmers a lot easier.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
As mentioned you could not simply run FORTRAN on any machine. It had to be rewritten for each particular machine if the type of processor was different. In in that early days ALL types were different. This did not promote the development of programming at all!</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<br /></div>
<div align="left" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<b><span style="color: #0066cc;"><a href="https://www.blogger.com/null" name="c" style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: 12pt;"></a>Enter "C"</span></b></div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
C came into being in the years 1969-1973 and was developed by Dennis Richey and David Kerningham both working at the Bell laboratories.<a href="https://www.thocp.net/software/software_reference/introduction_to_software_history.htm#3" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">(3)</a></div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
And the magic word was portability.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Parallel at the development of computer languages, Operating Systems (OS) were developed. These were needed because to create programs and having to write all machine specific instructions over and over again was a "waste of time" job.<br />So by introducing the OS 'principle' almost all input and output tasks were taken over by the OS.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Such as:</div>
<ul style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px;">
<li>writing data to and from memory,</li>
<li>saving data on disks,</li>
<li>writing data to screens and printers,</li>
<li>starting tapes,</li>
<li>refreshing memory,</li>
<li>scheduling specific tasks</li>
<li>etcetera, etcetera.</li>
</ul>
<div class="footer" style="color: #804040; font-family: Arial, Helvetica, sans-serif; font-size: 8pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
(More on operating systems in another chapter)</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
As the common computer languages had trouble to be translated from one machine to another the OS's had to take the same hurdle every time a new machine was developed.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
The need ad pressure for a common portable language was enormous.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
There were some unsuccessful projects aimed to solve this problem, like Multics, a joint venture of MIT, General Electric, and Bell Labs. And other developments at DOD's in different countries. But they all came either too late or became too complex to succeed.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
But the demise of Multics inspired Dennis Ritchie and Brian Kernigham to develop <a href="https://www.thocp.net/software/languages/c.htm" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0066cc; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; text-decoration: none;">C</a> in 1972. This was and still is a very strict language that stayed close enough to the machine's internal logic and structure. If you were allowed to say that. This new language was reasonable well to read and understand by humans. And because of this combination the language is fast, compact and became very popular amongst system programmers and commercial software manufacturers.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
With that language they also developed UNIX, a generic operating system.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
The power of C was that the language had a small language base (vocabulary) but leaned heavily on what they called libraries. Libraries contain machine specific instructions to perform tasks, like the OS does. These libraries were the only parts that had to be redesigned for different machines, or processor families. But, and that was C's strength, the programming interface/language remained the same. Portability was born. Sourcecode could be reused, only to be recompiled when it had to run on other machines.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
A classic example of C, printing "Hello World" on your screen:</div>
<blockquote style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px;">
</blockquote>
<table align="center" bgcolor="#FFFFCC" border="1" bordercolor="#804040" cellpadding="5" cellspacing="0" style="font-family: verdana, arial, helvetica, sans-serif; width: 31%px;"><tbody>
<tr style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><td style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;"><div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
/* helloworld.c */</div>
<blockquote>
<div style="font-size: 12pt; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
main()<br />{<br />printf('Hello World\n");<br />}</div>
</blockquote>
</td></tr>
</tbody></table>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
In another chapter this routine will be shown to make the various differences in language visual.</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
Soon other language manufacturers sprang on the bandwagon and the software industry leaped ahead. The industry took of like a rocket!</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<br /></div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
For More Details About Please visit our website at www.allcadsercvices.com</div>
<div style="font-family: verdana, arial, helvetica, sans-serif; font-size: 16px; line-height: 20pt; margin-left: 10px; margin-right: 10px;">
<br /></div>
</div>
Allcad Serviceshttp://www.blogger.com/profile/12867861373206421561noreply@blogger.com1tag:blogger.com,1999:blog-6237687327557176974.post-29275395462973185452017-02-16T04:00:00.001-08:002017-02-16T04:00:12.700-08:00Web Application Development using Angular.Js<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="two_columns_layout-content" style="-webkit-box-flex: 1; border: 0px; box-sizing: border-box; flex-grow: 1; margin: 0px 10px; min-height: 0px; min-width: 0px; padding: 0px; position: relative; vertical-align: baseline;">
<div class="post is-full" style="-webkit-box-direction: normal; -webkit-box-flex: 1; -webkit-box-orient: vertical; background: rgb(255, 255, 255); border: 1px solid rgb(231, 231, 231); box-shadow: rgba(0, 0, 0, 0.0980392) 0px 2px 5px; box-sizing: border-box; display: flex; flex-direction: column; flex-grow: 1; margin: 0px; min-height: 0px; min-width: 0px; padding: 25px 37px; vertical-align: baseline;">
<div class="content_body" data-subscribe="true" data-view="content#body" style="border: 0px; box-sizing: border-box; font-size: 15px; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Choosing the right tool for the right purpose goes a long way, especially when it comes to building modern web applications. A lot of us are familiar with AngularJS and how easy it makes developing robust web application front-ends. Although many will argue against the use of this popular web framework, it certainly has plenty to offer and can be <a href="https://www.toptal.com/angular-js/a-step-by-step-guide-to-your-first-angularjs-app" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">an appropriate choice</a> for a wide array of needs. On the other hand, the components that you use on the back-end will dictate a lot about the web application’s performance, as they have influence on the overall user experience. <a href="https://www.playframework.com/" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">Play</a> is a high velocity web framework for Java and Scala. It is based on a lightweight, stateless, web-friendly architecture and follows MVC patterns and principles similar to Rails and Django.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><img alt="web applications with angularjs and play framework" height="640" src="https://uploads.toptal.io/blog/image/91216/toptal-blog-image-1432641167534-42306bf1ba9f258d17ac8e7a487b56ed.gif" style="border: 0px; box-sizing: border-box; display: block; margin: 0px auto 7px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" width="640" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;">AllCAD Services Private Limited</td></tr>
</tbody></table>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
In this article, we will take a look at how we can use AngularJS and Play to build a simple blog application with a basic authentication mechanism and the ability to make posts and comments. <a href="https://www.toptal.com/angular-js" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">AngularJS</a>, with some <a href="https://www.toptal.com/twitter-bootstrap" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">Twitter Bootstrap</a> goodies, will allow us to power a single-page application experience on top of a Play based REST API back-end.</div>
<h2 id="web-applications---getting-started" style="border: 0px; box-sizing: border-box; color: #3863a0; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Web Applications - Getting Started</h2>
<h2 id="angularjs-application-skeleton" style="border: 0px; box-sizing: border-box; color: #3863a0; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
AngularJS Application Skeleton</h2>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
AngularJS and Play apps will reside in client and server directories accordingly. For now, we shall create the “client” directory.</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">mkdir -p blogapp/client
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
To create an AngularJS application skeleton, we will use Yeoman - an amazing scaffolding tool. <a href="https://www.toptal.com/angular-js/your-first-angularjs-app-part-2-scaffolding-building-and-testing" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">Installing Yeoman is easy</a>. Using it to scaffold a simple skeletal AngularJS application is probably even easier:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">cd blogapp/client
yo angular
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Running the second command will be followed by a few options that you need to pick from. For this project, we do not need “Sass (with Compass)”. We will need Boostrap along with the following AngularJS plugins:</div>
<ul style="border: 0px; box-sizing: border-box; font-size: 1.2em; list-style: none; margin: 0px 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: border-box; line-height: 1.5em; list-style-type: disc; margin: 0px 0px 0.75em 30px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">angular-animate.js</li>
<li style="border: 0px; box-sizing: border-box; line-height: 1.5em; list-style-type: disc; margin: 0px 0px 0.75em 30px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">angular-cookies.js</li>
<li style="border: 0px; box-sizing: border-box; line-height: 1.5em; list-style-type: disc; margin: 0px 0px 0.75em 30px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">angular-resource.js</li>
<li style="border: 0px; box-sizing: border-box; line-height: 1.5em; list-style-type: disc; margin: 0px 0px 0.75em 30px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">angular-route.js</li>
<li style="border: 0px; box-sizing: border-box; line-height: 1.5em; list-style-type: disc; margin: 0px 0px 0.75em 30px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">angular-sanitize.js</li>
<li style="border: 0px; box-sizing: border-box; line-height: 1.5em; list-style-type: disc; margin: 0px 0px 0.75em 30px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">angular-touch.js</li>
</ul>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
At this point, once you finalize your selections, you will start seeing NPM and Bower output on your terminal. When the downloads are complete and the packages have been installed, you will have an AngularJS application skeleton ready to be used.</div>
<h2 id="play-framework-application-skeleton" style="border: 0px; box-sizing: border-box; color: #3863a0; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Play Framework Application Skeleton</h2>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
The official way of creating a new Play application involves the use of the tool Type safe Activator. Before you can use it, you have to download and install it on your computer. If you are on Mac OS and use Homebrew, you can install this tool with a single line of command:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">brew install typesafe-activator
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Creating a Play application from command line is super easy:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">cd blogapp/
activator new server play-java
cd server/
</code></pre>
<h3 id="importing-to-an-ide" style="border: 0px; box-sizing: border-box; color: #3863a0; font-size: 1.3em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Importing to an IDE</h3>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
To import the application in an IDE such as Eclipse or IntelliJ, you need to “eclipsify” or “idealize” your application. To do that, run the following command:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">activator
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Once you see a new prompt, type either “eclipse” or “idea” and hit enter to prepare the application code for Eclipse or IntelliJ, respectively.</div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
For brevity, we will only cover the process of importing the project to IntelliJ in this article. The process of importing it to Eclipse should be equally simple. To import the project to IntelliJ, start by activating the “Project from existing sources…” option found under “File -> New”. Next, select your build.sbt file and click “OK”. Upon clicking “OK” again on the next dialog, IntelliJ should start importing your Play application as an SBT project.</div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Typesafe Activator also comes with a graphical user interface, which you can use to <a href="https://www.typesafe.com/activator/docs" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">create this skeletal application code</a>.</div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Now that we have imported our Play application into IntelliJ, we should also import our AngularJS application into the workspace. We can import it either as a separate project or as a module to the existing project where Play application resides.</div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Here, we will import the Angular application as a module. Under the “File” menu, we will select the option “New -> Module From Existing Sources…”. From the dialog, we will choose the “client” directory and click on “OK”. On the next two screens, click on “Next” and “Finish”, respectively.</div>
<h3 id="spawning-local-servers" style="border: 0px; box-sizing: border-box; color: #3863a0; font-size: 1.3em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Spawning Local Servers</h3>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
At this point, it should be possible to start the AngularJS application as a Grunt task from the IDE. Expand your client folder and right click on Gruntfile.js. In the pop-up menu select “Show Grunt Tasks”. A panel labelled “Grunt” will appear with a list of tasks:</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8PozaGeHuyR31GnJkLwC-OE6BhmWpzlO6FD3CXzURG3gq0ZHcJAp-fmAlLY6WXAhUKqnZMypWfmV_UqamabuNxaWVEiGd0XnG1jgbEk6IY8WW_VEDplf1k4sPyYPYfY4HF0e9NaCj6PE/s1600/download.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="213" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8PozaGeHuyR31GnJkLwC-OE6BhmWpzlO6FD3CXzURG3gq0ZHcJAp-fmAlLY6WXAhUKqnZMypWfmV_UqamabuNxaWVEiGd0XnG1jgbEk6IY8WW_VEDplf1k4sPyYPYfY4HF0e9NaCj6PE/s320/download.jpg" width="320" /></a></div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<br /></div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
To start serving the application, double click on “serve”. This should immediately open your default web browser and point it to a localhost address. You should see a stub AngularJS page with Yeoman’s logo on it.</div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Next, we need to launch our back-end application server. Before we can proceed, we must address a couple of issues:</div>
<ol style="border: 0px; box-sizing: border-box; font-size: 1.2em; list-style: none; margin: 0px 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: border-box; line-height: 1.5em; list-style-type: decimal; margin: 0px 0px 0.75em 30px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">By default, both the AngularJS application (bootstrapped by Yeoman) and the Play application tries to run on port 9000.</li>
<li style="border: 0px; box-sizing: border-box; line-height: 1.5em; list-style-type: decimal; margin: 0px 0px 0.75em 30px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">In production, both applications will likely be run under one domain, and we will probably use Nginx to route the requests accordingly. But in development mode, when we change the port number of one of these applications, web browsers will treat them as if they are running on different domains.</li>
</ol>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
To work around both of these issues, all we need to do is use a Grunt proxy so that all AJAX requests to the Play application are peroxided. With this, in essence both of these application servers will be available at the same apparent port number.</div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Let us first change the port number of the Play application server to 9090. To do this, open the “Run/Debug Configurations” window by clicking on “Run -> Edit Configurations”. Next, change the port number in the field “Url To Open”. Click on “OK” to approve this change and close the window. Clicking on the “Run” button should start the dependency resolution process - logs of this process will start appearing.</div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<br /></div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Once it is done, you can navigate to http://localhost:9090 on your web browser, and in a few seconds you should be able to see your Play application. To configure a Grunt proxy, we first need to install a small Node.js package using NPM:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">cd blogapp/client
npm install grunt-connect-proxy --save-dev
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Next we need to tweak our Gruntfile.js. In that file, locate the “connect” task, and insert the “proxies” key/value after it:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-json hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"> proxies: [
{
context: '/app', // the context of the data service
host: 'localhost', // wherever the data service is running
port: 9090, // the port that the data service is running on
changeOrigin: true
}
],
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Grunt will now proxy all requests to “/app/*” to the back-end Play application. This will save us from having to whitelist every call to the back-end. Furthermore, we also need to tweak our livereload behavior:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">livereload: {
options: {
open: true,
middleware: function (connect) {
var middlewares = [];
// Setup the proxy
middlewares.push(require('grunt-connect-proxy/lib/utils').proxyRequest);
// Serve static files
middlewares.push(connect.static('.tmp'));
middlewares.push(connect().use(
'/bower_components',
connect.static('./bower_components')
));
middlewares.push(connect().use(
'/app/styles',
connect.static('./app/styles')
));
middlewares.push(connect.static(appConfig.app));
return middlewares;
}
}
},
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Finally, we need to add a new dependency “’configureProxies:server” to the “serve” task:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
}
grunt.task.run([
'clean:server',
'wiredep',
'concurrent:server',
'autoprefixer:server',
'configureProxies:server',
'connect:livereload',
'watch'
]);
});
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Upon restarting Grunt, you should notice the following lines in your logs indicating that the proxy is running:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">Running "autoprefixer:server" (autoprefixer) task
File .tmp/styles/main.css created.
Running "configureProxies:server" (configureProxies) task
Running "connect:livereload" (connect) task
Started connect web server on http://localhost:9000
</code></pre>
<h3 id="creating-a-sign-up-form" style="border: 0px; box-sizing: border-box; color: #3863a0; font-size: 1.3em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Creating a Sign-up Form</h3>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
We will begin by creating a sign-up form for our blog application. This will also allow us to verify that everything is working as it should. We can use Yeoman to create a Sign-up controller and view in AngularJS:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">yo angular:controller signup
yo angular:view signup
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Next we should update routing of our application to reference this newly created view, and remove the redundant auto-generated “about” controller and view. From within the file “app/scripts/app.js”, remove references to “app/scripts/controllers/about.js” and “app/views/about.html”, leaving it with:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-js hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">.config(<span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span> <span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">($routeProvider)</span> {</span>
$routeProvider
.when(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'/'</span>, {
templateUrl: <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'views/main.html'</span>,
controller: <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'MainCtrl'</span>
})
.when(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'/signup'</span>, {
templateUrl: <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'views/signup.html'</span>,
controller: <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'SignupCtrl'</span>
})
.otherwise({
redirectTo: <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'/'</span>
});
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Similarly, update the “app/index.html” file to remove the redundant links, and add a link to the signup page:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-html hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"collapse navbar-collapse"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">id</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"js-navbar-collapse"</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ul</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"nav navbar-nav"</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">li</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"active"</span>></span><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">a</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">href</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"#/"</span>></span>Home<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">a</span>></span><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">li</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">li</span>></span><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">a</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ng-href</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"#/signup"</span>></span>Signup<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">a</span>></span><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">li</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ul</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span>></span>
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Also, remove the script tag for “about.js”:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-html hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-comment" style="border: 0px; box-sizing: border-box; color: #93a1a1; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><!-- build:js({.tmp,app}) scripts/scripts.js --></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">script</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">src</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"scripts/app.js"</span>></span><span class="javascript" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></span><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">script</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">script</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">src</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"scripts/controllers/main.js"</span>></span><span class="javascript" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></span><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">script</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">script</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">src</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"scripts/controllers/signup.js"</span>></span><span class="javascript" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></span><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">script</span>></span>
<span class="hljs-comment" style="border: 0px; box-sizing: border-box; color: #93a1a1; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><!-- endbuild --></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">body</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">html</span>></span>
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Next, add a form to our “signup.html” file:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-html hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">form</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">name</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"signupForm"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ng-submit</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"signup()"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">novalidate</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">label</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">for</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"email"</span>></span>Email<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">label</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">input</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">name</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"email"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"form-control"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">type</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"email"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">id</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"email"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">placeholder</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"Email"</span>
<span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ng-model</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"email"</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">label</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">for</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"password"</span>></span>Password<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">label</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">input</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">name</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"password"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"form-control"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">type</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"password"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">id</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"password"</span>
<span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">placeholder</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"Password"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ng-model</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"password"</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">button</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">type</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"submit"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"btn btn-primary"</span>></span>Sign up!<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">button</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">form</span>></span>
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
We need to make the form be processed by the Angular controller. It is worth noting that we do not need to specifically add the “ng-controller” attribute in our views, as our routing logic in “app.js” fires up a controller automatically before our view is loaded. All we have to do to wire this form up is have a proper “signup” function defined in $scope. This should be done in the “signup.js” file:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-js hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">angular.module(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'clientApp'</span>)
.controller(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'SignupCtrl'</span>, <span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span> <span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">($scope, $http, $log)</span> {</span>
$scope.signup = <span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">()</span> {</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">var</span> payload = {
email : $scope.email,
password : $scope.password
};
$http.post(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'app/signup'</span>, payload)
.success(<span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">(data)</span> {</span>
$log.debug(data);
});
};
});
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Now let us open Chrome developer console, switch to the “Network” tab, and try to submit the signup form.</div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<br /></div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
We’ll see that the Play back-end naturally replies with an “Action not found” error page. This is expected as it has not been implemented yet. But what it also means is that our Grunt proxy setup is working correctly!</div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Next, we are going to add an “Action” which is essentially a method in the Play application controller. In the class “Application” in “app/controllers” package, add a new method “signup”:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> Result <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">signup</span>() {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> ok(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"Success!"</span>);
}
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Now open the file “conf/routes” and add the following line:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">POST /app/signup controllers.Application.signup
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Finally, we return to our web browser, http://localhost:9000/#/signup. Clicking on the “Submit” button this time should yield something different:</div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<br /></div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
You should be seeing the hard-coded value returned, the one we wrote in the signup method. If that is the case, we are ready to move on as our development environment is ready and is working for both the Angular and Play applications.</div>
<h3 id="defining-ebean-models-in-play" style="border: 0px; box-sizing: border-box; color: #3863a0; font-size: 1.3em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Defining Ebean Models in Play</h3>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Before defining models, let us first pick a data store. In this article, we will use H2 in-memory database. To enable that, find and commencement the following lines in the file “application.conf”:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play"
db.default.user=sa
db.default.password=""
...
ebean.default="models.*"
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
And add the following line:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">applyEvolutions.default=true
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Our blog domain model is rather simple. First of all, we have users that may create posts and then each post can be commented on by any signed in user. Let’s create our Eben Models.</div>
<h4 id="user" style="border: 0px; box-sizing: border-box; color: #3863a0; font-size: 1.2em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
User</h4>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-comment" style="border: 0px; box-sizing: border-box; color: #93a1a1; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">// User.java</span>
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Entity</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-class" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">User</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">extends</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">Model</span> {</span>
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Id</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> Long id;
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Column</span>(length = <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">255</span>, unique = <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">true</span>, nullable = <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">false</span>)
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Constraints</span>.MaxLength(<span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">255</span>)
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Constraints</span>.Required
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Constraints</span>.Email
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> String email;
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Column</span>(length = <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">64</span>, nullable = <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">false</span>)
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">private</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">byte</span>[] shaPassword;
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@OneToMany</span>(cascade = CascadeType.ALL)
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@JsonIgnore</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> List<BlogPost> posts;
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">void</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">setPassword</span>(String password) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">this</span>.shaPassword = getSha512(password);
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">void</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">setEmail</span>(String email) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">this</span>.email = email.toLowerCase();
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">final</span> Finder<Long, User> find = <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">new</span> Finder<Long, User>(
Long.class, User.class);
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> User <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">findByEmailAndPassword</span>(String email, String password) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> find
.where()
.eq(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"email"</span>, email.toLowerCase())
.eq(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"shaPassword"</span>, getSha512(password))
.findUnique();
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> User <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">findByEmail</span>(String email) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> find
.where()
.eq(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"email"</span>, email.toLowerCase())
.findUnique();
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">byte</span>[] <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">getSha512</span>(String value) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">try</span> {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> MessageDigest.getInstance(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"SHA-512"</span>).digest(value.getBytes(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"UTF-8"</span>));
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">catch</span> (NoSuchAlgorithmException e) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">throw</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">new</span> RuntimeException(e);
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">catch</span> (UnsupportedEncodingException e) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">throw</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">new</span> RuntimeException(e);
}
}
}
</code></pre>
<h4 id="blogpost" style="border: 0px; box-sizing: border-box; color: #3863a0; font-size: 1.2em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
BlogPost</h4>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-comment" style="border: 0px; box-sizing: border-box; color: #93a1a1; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">// BlogPost.java</span>
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Entity</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-class" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">BlogPost</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">extends</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">Model</span> {</span>
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Id</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> Long id;
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Column</span>(length = <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">255</span>, nullable = <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">false</span>)
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Constraints</span>.MaxLength(<span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">255</span>)
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Constraints</span>.Required
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> String subject;
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Column</span>(columnDefinition = <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"TEXT"</span>)
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Constraints</span>.Required
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> String content;
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@ManyToOne</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> User user;
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> Long commentCount;
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@OneToMany</span>(cascade = CascadeType.ALL)
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> List<PostComment> comments;
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">final</span> Finder<Long, BlogPost> find = <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">new</span> Finder<Long, BlogPost>(
Long.class, BlogPost.class);
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> List<BlogPost> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">findBlogPostsByUser</span>(<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">final</span> User user) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> find
.where()
.eq(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"user"</span>, user)
.findList();
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> BlogPost <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">findBlogPostById</span>(<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">final</span> Long id) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> find
.where()
.eq(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"id"</span>, id)
.findUnique();
}
}
</code></pre>
<div class="embeddable_form-wrapper for-post" data-role="blog_subscribe" data-view="blog_subscribe#form" style="border-radius: 6px; border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 30px 0px; vertical-align: baseline;">
<form action="https://www.toptal.com/blog/subscription" class="embeddable_form" data-entity="blog_subscription" data-remote="" data-view="form#form" method="post" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<div class="embeddable_form-step is-email_form is-current" style="border: 0px; box-sizing: border-box; display: flex; flex-wrap: wrap; height: auto; margin: 0px; min-height: 0px; min-width: 0px; overflow: visible; padding: 0px; vertical-align: baseline;">
<div class="embeddable_form-row is-label" style="border: 0px; box-sizing: border-box; margin: 0px 0px 10px; min-height: 0px; min-width: 0px; padding: 0px; position: relative; vertical-align: baseline;">
<div class="embeddable_form-label_title" style="border: 0px; box-sizing: border-box; color: #2557a1; display: inline-block; font-size: 17px; font-weight: 700; line-height: 23px; margin: 0px 10px 0px 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Like what you're reading?</div>
<div class="embeddable_form-label" style="border: 0px; box-sizing: border-box; color: #313131; display: inline-block; font-size: 17px; font-style: italic; line-height: 19px; margin: 0px 10px 0px 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Get the latest updates first.</div>
</div>
<div class="embeddable_form-row form-field is-email_field" style="border: 0px; box-sizing: border-box; flex-basis: 100%; margin: 0px 0px 10px; min-height: 0px; min-width: 0px; padding: 0px; position: relative; vertical-align: baseline;">
<input autocomplete="off" class="input is-medium" data-role="email" name="blog_subscription[email]" placeholder="Enter your email address..." style="-webkit-appearance: none; background: rgb(250, 250, 250); border-color: rgb(238, 238, 238); border-radius: 4px; border-style: solid; border-width: 1px; color: #3c3c3c; font-family: proxima-nova, Arial, sans-serif; font-size: 14px; margin-bottom: 0px; margin-top: 0px; padding: 15px 12px; transition: all 0.2s; width: 864px;" type="text" /></div>
<div class="embeddable_form-row is-submit" style="-webkit-box-flex: 1; -webkit-box-ordinal-group: 4; border: 0px; box-sizing: border-box; flex-grow: 1; margin: 0px; min-height: 0px; min-width: 0px; order: 3; padding: 0px; position: relative; vertical-align: baseline;">
<input class="button is-green_candy is-default is-full_width" data-loader-text="Subscribing..." data-role="submit" style="-webkit-appearance: none; background-attachment: initial; background-clip: initial; background-image: linear-gradient(rgb(67, 198, 146), rgb(57, 184, 133)); background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-color: rgb(31, 124, 87); border-radius: 4px; border-style: solid; border-width: 1px; box-shadow: rgb(79, 211, 170) 0px 1px inset; color: white; cursor: pointer; font-size: 14px; font-weight: 600; padding: 15px 20px; position: relative; text-shadow: rgb(28, 143, 61) 0px 1px 0px; transition: background 150ms; width: 613.953px;" type="submit" value="Get Exclusive Updates" /></div>
<div class="embeddable_form-row is-privacy" style="border: 0px; box-sizing: border-box; margin: 0px 20px 0px 0px; min-height: 0px; min-width: 0px; padding: 0px; position: relative; vertical-align: baseline;">
<div class="embeddable_form-privacy" style="-webkit-box-align: center; align-items: center; border: 0px; box-sizing: border-box; color: #9a9a9a; display: flex; font-size: 12px; line-height: 50px; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<div class="embeddable_form-privacy_icon" style="background: url("/assets/front/static/public/primitives/icon/lock_ed584f.png") 0% 0% / 9.5px 11.5px no-repeat; border: 0px; box-sizing: border-box; display: inline-block; flex-shrink: 0; height: 11.5px; margin: 0px 15px 0px 0px; min-height: 0px; min-width: 0px; padding: 0px; position: relative; top: -2px; vertical-align: baseline; width: 9.5px;">
</div>
<div class="embeddable_form-privacy_text" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<br /></div>
</div>
</div>
</div>
<div class="embeddable_form-step is-confirmation" data-place="@blog_subscribe" data-role="confirmation" style="border: 0px; box-sizing: border-box; height: 0px; margin: 0px; min-height: 0px; min-width: 0px; overflow: hidden; padding: 0px; vertical-align: baseline;">
<div class="embeddable_form-row is-label is-success" style="border: 0px; box-sizing: border-box; margin: 0px 0px 10px; min-height: 0px; min-width: 0px; padding: 0px; position: relative; vertical-align: baseline; width: 864px;">
<div class="embeddable_form-label_title" style="border: 0px; box-sizing: border-box; color: #2557a1; display: inline-block; font-size: 17px; font-weight: 700; line-height: 23px; margin: 0px 10px 0px 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
</div>
<div class="embeddable_form-label" style="border: 0px; box-sizing: border-box; color: #313131; display: inline-block; font-size: 17px; font-style: italic; line-height: 19px; margin: 0px 10px 0px 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
</div>
</div>
<div class="embeddable_form-row is-success" style="border: 0px; box-sizing: border-box; margin: 0px 0px 10px; min-height: 0px; min-width: 0px; padding: 0px; position: relative; vertical-align: baseline; width: 864px;">
<div class="embeddable_form-label is-header" style="border: 0px; box-sizing: border-box; color: #313131; display: inline-block; font-size: 17px; font-style: italic; line-height: 19px; margin: 0px 10px 0px 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
</div>
<div class="embeddable_form-label" style="border: 0px; box-sizing: border-box; color: #313131; display: inline-block; font-size: 17px; font-style: italic; line-height: 19px; margin: 0px 10px 0px 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<a data-role="preferences_link" href="https://www.toptal.com/java/building-modern-web-applications-with-angularjs-and-play-framework#" style="border: 0px; box-sizing: border-box; color: #3976cb; display: inline; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; text-decoration: none; transition: color 150ms, transform, text-shadow, -webkit-transform; vertical-align: baseline;"></a></div>
</div>
<div class="embeddable_form-row is-success" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; position: relative; vertical-align: baseline; width: 864px;">
<ul class="social_share is-horizontal is-loaded" data-rss-url="https://www.toptal.com/developers/blog.rss" data-twitter-username="@toptal" data-url="https://www.toptal.com/developers/blog" data-view="layout#social_share" data-youtube-channel-url="https://www.youtube.com/channel/UCNqm_euTHZz3o5OnKhUS-oA" style="-webkit-box-direction: normal; -webkit-box-orient: horizontal; -webkit-box-pack: start; border: 0px; box-sizing: border-box; display: flex; flex-direction: row; font-size: 1.2em; justify-content: flex-start; list-style: none; margin: 0px; max-width: 300px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<li class="social_share-item is-counter" style="background-color: #3863a0; border-bottom-color: rgb(236, 236, 236); border-bottom-style: solid; border-image: initial; border-left-color: rgb(236, 236, 236); border-left-style: solid; border-radius: 4px 0px 0px 4px; border-right-color: rgb(56, 99, 160) !important; border-right-style: initial; border-top-color: rgb(236, 236, 236); border-top-style: solid; border-width: 1px 0px 1px 1px; box-sizing: border-box; color: white; flex-shrink: 0; height: 50px; line-height: 15px; list-style-type: disc; margin-bottom: 0.75em; margin-left: 30px; margin-right: 0px !important; margin-top: 0px !important; min-height: 0px; min-width: 0px; padding: 10px 0px; position: relative; text-align: center; text-shadow: rgba(0, 0, 0, 0.498039) 0px 1px 2px; transition: box-shadow 0.2s; vertical-align: baseline; width: 50px;" title="Total number of shares"><span class="social_share-item_num" data-role="counter_num" style="border: 0px; box-sizing: border-box; display: block; font-size: 14px; margin: 0px; min-height: 0px; min-width: 0px; opacity: 1; padding: 0px; transition: opacity 0.3s; vertical-align: baseline;"></span><span class="social_share-item_text" data-role="counter_text" style="border: 0px; box-sizing: border-box; display: block; font-size: 9px; margin: 0px; min-height: 0px; min-width: 0px; opacity: 1; padding: 0px; text-transform: uppercase; transition: opacity 0.3s; vertical-align: baseline;"></span></li>
<li class="social_share-item" style="border-bottom-color: rgb(236, 236, 236); border-bottom-style: solid; border-image: initial; border-left-color: rgb(236, 236, 236); border-left-style: solid; border-right-color: initial; border-right-style: initial; border-top-color: rgb(236, 236, 236); border-top-style: solid; border-width: 1px 0px 1px 1px; box-sizing: border-box; flex-shrink: 0; height: 50px; line-height: 1.5em; list-style-type: disc; margin-bottom: 0.75em; margin-left: 30px; margin-right: 0px !important; margin-top: 0px !important; min-height: 0px; min-width: 0px; padding: 0px; text-shadow: rgba(0, 0, 0, 0.498039) 0px 1px 2px; transition: box-shadow 0.2s; vertical-align: baseline; width: 50px;"><a class="social_share-item_link" data-role="link" data-track-click="SocialShareButtonClicked" data-track-default-data="{"network":"facebook"}" data-type="facebook" href="https://www.blogger.com/null" style="border: 0px; box-sizing: border-box; color: #3976cb; cursor: pointer; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" title="Share on Facebook"><img class="social_share-item_image" height="50" src="https://assets.toptal.io/assets/front/static/public/primitives/social/share_bar/facebook_dc66c9.png" style="border: 0px; box-sizing: border-box; display: block; height: 50px; margin: 0px auto 7px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline; width: 50px;" width="50" /></a></li>
<li class="social_share-item" style="border-bottom-color: rgb(236, 236, 236); border-bottom-style: solid; border-image: initial; border-left-color: rgb(236, 236, 236); border-left-style: solid; border-right-color: initial; border-right-style: initial; border-top-color: rgb(236, 236, 236); border-top-style: solid; border-width: 1px 0px 1px 1px; box-sizing: border-box; flex-shrink: 0; height: 50px; line-height: 1.5em; list-style-type: disc; margin-bottom: 0.75em; margin-left: 30px; margin-right: 0px !important; margin-top: 0px !important; min-height: 0px; min-width: 0px; padding: 0px; text-shadow: rgba(0, 0, 0, 0.498039) 0px 1px 2px; transition: box-shadow 0.2s; vertical-align: baseline; width: 50px;"><a class="social_share-item_link" data-role="link" data-track-click="SocialShareButtonClicked" data-track-default-data="{"network":"google_plus"}" data-type="google_plus" href="https://www.blogger.com/null" style="border: 0px; box-sizing: border-box; color: #3976cb; cursor: pointer; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" title="Share on Google Plus"><img class="social_share-item_image" height="50" src="https://assets.toptal.io/assets/front/static/public/primitives/social/share_bar/google_plus_355fb0.png" style="border: 0px; box-sizing: border-box; display: block; height: 50px; margin: 0px auto 7px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline; width: 50px;" width="50" /></a></li>
<li class="social_share-item" style="border-radius: 0px 4px 4px 0px; border: 1px solid rgb(236, 236, 236); box-sizing: border-box; flex-shrink: 0; height: 50px; line-height: 1.5em; list-style-type: disc; margin-bottom: 0px; margin-left: 30px; margin-right: 0px !important; margin-top: 0px !important; min-height: 0px; min-width: 0px; padding: 0px; text-shadow: rgba(0, 0, 0, 0.498039) 0px 1px 2px; transition: box-shadow 0.2s; vertical-align: baseline; width: 50px;"><a class="social_share-item_link" data-role="link" data-track-click="SocialShareButtonClicked" data-track-default-data="{"network":"twitter_follow"}" data-type="twitter_follow" href="https://www.blogger.com/null" style="border: 0px; box-sizing: border-box; color: #3976cb; cursor: pointer; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" title="Follow Toptal on Twitter"><img class="social_share-item_image" height="50" src="https://assets.toptal.io/assets/front/static/public/primitives/social/share_bar/twitter_83c6d4.png" style="border: 0px; box-sizing: border-box; display: block; height: 50px; margin: 0px auto 7px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline; width: 50px;" width="50" /></a></li>
</ul>
</div>
</div>
</form>
</div>
<h4 id="postcomment" style="border: 0px; box-sizing: border-box; color: #3863a0; font-size: 1.2em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
PostComment</h4>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-comment" style="border: 0px; box-sizing: border-box; color: #93a1a1; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">// PostComment.java</span>
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Entity</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-class" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">PostComment</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">extends</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">Model</span> {</span>
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Id</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> Long id;
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@ManyToOne</span>
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@JsonIgnore</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> BlogPost blogPost;
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@ManyToOne</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> User user;
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Column</span>(columnDefinition = <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"TEXT"</span>)
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> String content;
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">final</span> Finder<Long, PostComment> find = <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">new</span> Finder<Long, PostComment>(
Long.class, PostComment.class);
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> List<PostComment> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">findAllCommentsByPost</span>(<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">final</span> BlogPost blogPost) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> find
.where()
.eq(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"post"</span>, blogPost)
.findList();
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> List<PostComment> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">findAllCommentsByUser</span>(<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">final</span> User user) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> find
.where()
.eq(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"user"</span>, user)
.findList();
}
}
</code></pre>
<h3 id="real-signup-action" style="border: 0px; box-sizing: border-box; color: #3863a0; font-size: 1.3em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Real Signup Action</h3>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Now let’s create our first real action, allowing the users to sign up:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-comment" style="border: 0px; box-sizing: border-box; color: #93a1a1; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">// Application.java</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> Result <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">signup</span>() {
Form<SignUp> signUpForm = Form.form(SignUp.class).bindFromRequest();
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span> ( signUpForm.hasErrors()) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> badRequest(signUpForm.errorsAsJson());
}
SignUp newUser = signUpForm.get();
User existingUser = User.findByEmail(newUser.email);
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span>(existingUser != <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">null</span>) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> badRequest(buildJsonResponse(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"error"</span>, <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"User exists"</span>));
} <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">else</span> {
User user = <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">new</span> User();
user.setEmail(newUser.email);
user.setPassword(newUser.password);
user.save();
session().clear();
session(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"username"</span>, newUser.email);
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> ok(buildJsonResponse(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"success"</span>, <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"User created successfully"</span>));
}
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> <span class="hljs-class" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">UserForm</span> {</span>
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Constraints</span>.Required
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Constraints</span>.Email
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> String email;
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> <span class="hljs-class" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">SignUp</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">extends</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">UserForm</span> {</span>
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Constraints</span>.Required
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Constraints</span>.MinLength(<span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">6</span>)
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> String password;
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">private</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> ObjectNode <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">buildJsonResponse</span>(String type, String message) {
ObjectNode wrapper = Json.newObject();
ObjectNode msg = Json.newObject();
msg.put(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"message"</span>, message);
wrapper.put(type, msg);
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> wrapper;
}
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Note that the authentication used in this app is very basic, and is not recommended for production use.</div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
The interesting part is that we are using Play forms to handle signup forms. We set a couple constrains on our Sign Up form class. Validation will be done for us automatically without need for explicit validation logic.</div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
If we get back to our AngularJS application in the web browser and click on “Submit” again, we will see that the server now responds with an appropriate error - that these fields are required.</div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<img alt="" src="https://uploads.toptal.io/blog/image/91221/toptal-blog-image-1432641327393.5-b8f270fbee9c0eaed1864f8f79b97fb8.jpg" style="border: 0px; box-sizing: border-box; display: block; margin: 0px auto 7px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" /></div>
<h2 id="handling-server-errors-in-angularjs" style="border: 0px; box-sizing: border-box; color: #3863a0; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Handling Server Errors in AngularJS</h2>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
So we are getting an error from server, but the application user has no idea what’s going on. The least we can do is to display the error to our user. Ideally, we would need to understand what kind of error we’re getting and display a user-friendly message. Let’s create a simple alert service that will help us display the error.</div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
First, we need to generate a service template with Yeoman:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">yo angular:service alerts
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Next, add this code to “alerts.js”:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-js hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">angular.module(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'clientApp'</span>)
.factory(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'alertService'</span>, <span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">($timeout)</span> {</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">var</span> ALERT_TIMEOUT = <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">5000</span>;
<span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">add</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">(type, msg, timeout)</span> {</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span> (timeout) {
$timeout(<span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">()</span>{</span>
closeAlert(<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">this</span>);
}, timeout);
} <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">else</span> {
$timeout(<span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">()</span>{</span>
closeAlert(<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">this</span>);
}, ALERT_TIMEOUT);
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> alerts.push({
type: type,
msg: msg,
close: <span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">()</span> {</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> closeAlert(<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">this</span>);
}
});
}
<span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">closeAlert</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">(alert)</span> {</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> closeAlertIdx(alerts.indexOf(alert));
}
<span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">closeAlertIdx</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">(index)</span> {</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> alerts.splice(index, <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">1</span>);
}
<span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">clear</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">()</span>{</span>
alerts = [];
}
<span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">get</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">()</span> {</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> alerts;
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">var</span> service = {
add: add,
closeAlert: closeAlert,
closeAlertIdx: closeAlertIdx,
clear: clear,
get: get
},
alerts = [];
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> service;
}
);
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Now, let’s create a separate controller responsible for alerts:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">yo angular:controller alerts
</code></pre>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-js hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">angular.module(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'clientApp'</span>)
.controller(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'AlertsCtrl'</span>, <span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span> <span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">($scope, alertService)</span> {</span>
$scope.alerts = alertService.get();
});
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Now we need to actually show nice Bootstrap error messages. The easiest way is to use <a href="https://angular-ui.github.io/bootstrap/" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">Angular UI</a>. We can use Bower to install it:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">bower install angular-bootstrap --save
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
In your “app.js” append Angular UI module:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-js hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">angular
.module(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'clientApp'</span>, [
<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'ngAnimate'</span>,
<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'ngCookies'</span>,
<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'ngResource'</span>,
<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'ngRoute'</span>,
<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'ngSanitize'</span>,
<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'ngTouch'</span>,
<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'ui.bootstrap'</span>
])
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Let’s add alert directive to our “index.html” file:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-html hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"container"</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ng-controller</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"AlertsCtrl"</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">alert</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ng-repeat</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"alert in alerts"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">type</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"{{alert.type}}"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">close</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"alert.close()"</span>></span>{{ alert.msg }}<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">alert</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ng-view</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">""</span>></span><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span>></span>
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Finally, we need to update SignUp controller:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-js hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">angular.module(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'clientApp'</span>)
.controller(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'SignupCtrl'</span>, <span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span> <span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">($scope, $http, $log, alertService, $location, userService)</span> {</span>
$scope.signup = <span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">()</span> {</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">var</span> payload = {
email : $scope.email,
password : $scope.password
};
$http.post(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'app/signup'</span>, payload)
.error(<span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">(data, status)</span> {</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span>(status === <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">400</span>) {
angular.forEach(data, <span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">(value, key)</span> {</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span>(key === <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'email'</span> || key === <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'password'</span>) {
alertService.add(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'danger'</span>, key + <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">' : '</span> + value);
} <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">else</span> {
alertService.add(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'danger'</span>, value.message);
}
});
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span>(status === <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">500</span>) {
alertService.add(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'danger'</span>, <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'Internal server error!'</span>);
}
})
};
});
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Now if we send the empty form again we will see errors displayed above the form:</div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<img alt="" src="https://uploads.toptal.io/blog/image/91222/toptal-blog-image-1432641356880.1-cef2176a9631fd87fa952abdc197a822.jpg" style="border: 0px; box-sizing: border-box; display: block; margin: 0px auto 7px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" /></div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Now that errors are handled, we need to do something when user signup is successful. We can redirect the user to a dashboard page where he can add posts. But first, we must create it:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">yo angular:view dashboard
yo angular:controller dashboard
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Modify “signup.js” controller signup method so that on success it redirects the user:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-js hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">angular.module(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'clientApp'</span>)
.controller(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'SignupCtrl'</span>, <span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span> <span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">($scope, $http, $log, alertService, $location)</span> {</span>
<span class="hljs-comment" style="border: 0px; box-sizing: border-box; color: #93a1a1; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">// ..</span>
.success(<span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">(data)</span> {</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span>(data.hasOwnProperty(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'success'</span>)) {
$location.path(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'/dashboard'</span>);
}
});
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Add a new route in “apps.js”:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-js hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">.when(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'/dashboard'</span>, {
templateUrl: <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'views/dashboard.html'</span>,
controller: <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'DashboardCtrl'</span>
})
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
We also need to track if the user is logged in. Let us create a separate service for that:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">yo angular:service user
</code></pre>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-js hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-comment" style="border: 0px; box-sizing: border-box; color: #93a1a1; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">// user.js</span>
angular.module(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'clientApp'</span>)
.factory(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'userService'</span>, <span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">()</span> {</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">var</span> username = <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">''</span>;
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> {
username : username
};
});
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
And also modify the signup controller to set the user to one who just registered:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-js hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">.success(<span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">(data)</span> {</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span>(data.hasOwnProperty(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'success'</span>)) {
userService.username = $scope.email;
$location.path(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'/dashboard'</span>);;
}
});
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Before we add the main functionality of adding posts, let’s take care of some other important features such as ability to login and logout, displaying user information on the dashboard, and also adding authentication support in the back-end.</div>
<h2 id="basic-authentication" style="border: 0px; box-sizing: border-box; color: #3863a0; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Basic Authentication</h2>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Let’s jump over to our Play application and implement the login and logout actions. Add theses lines to “Application.java”:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> Result <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">login</span>() {
Form<Login> loginForm = Form.form(Login.class).bindFromRequest();
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span> (loginForm.hasErrors()) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> badRequest(loginForm.errorsAsJson());
}
Login loggingInUser = loginForm.get();
User user = User.findByEmailAndPassword(loggingInUser.email, loggingInUser.password);
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span>(user == <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">null</span>) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> badRequest(buildJsonResponse(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"error"</span>, <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"Incorrect email or password"</span>));
} <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">else</span> {
session().clear();
session(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"username"</span>, loggingInUser.email);
ObjectNode wrapper = Json.newObject();
ObjectNode msg = Json.newObject();
msg.put(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"message"</span>, <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"Logged in successfully"</span>);
msg.put(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"user"</span>, loggingInUser.email);
wrapper.put(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"success"</span>, msg);
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> ok(wrapper);
}
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> Result <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">logout</span>() {
session().clear();
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> ok(buildJsonResponse(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"success"</span>, <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"Logged out successfully"</span>));
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> Result <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">isAuthenticated</span>() {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span>(session().get(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"username"</span>) == <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">null</span>) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> unauthorized();
} <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">else</span> {
ObjectNode wrapper = Json.newObject();
ObjectNode msg = Json.newObject();
msg.put(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"message"</span>, <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"User is logged in already"</span>);
msg.put(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"user"</span>, session().get(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"username"</span>));
wrapper.put(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"success"</span>, msg);
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> ok(wrapper);
}
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> <span class="hljs-class" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">Login</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">extends</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">UserForm</span> {</span>
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Constraints</span>.Required
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> String password;
}
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Next let’s add the ability to allow particular back-end calls only to authenticated users. Create “Secured.java” with the following code:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-class" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">Secured</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">extends</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">Security</span>.<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">Authenticator</span> {</span>
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Override</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> String <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">getUsername</span>(Context ctx) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> ctx.session().get(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"username"</span>);
}
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Override</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> Result <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">onUnauthorized</span>(Context ctx) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> unauthorized();
}
}
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
We will use this class later to protect new actions. Next, we should tweak our AngularJS application main menu so that it displays the username and logout links. For that, we need to create controller:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">yo angular:controller menu
</code></pre>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">// menu.js
angular.module('clientApp')
.controller('MenuCtrl', function ($scope, $http, userService, $location) {
$scope.user = userService;
$scope.logout = function() {
$http.get('/app/logout')
.success(function(data) {
if(data.hasOwnProperty('success')) {
userService.username = '';
$location.path('/login');
}
});
};
$scope.$watch('user.username', function (newVal) {
if(newVal === '') {
$scope.isLoggedIn = false;
} else {
$scope.username = newVal;
$scope.isLoggedIn = true;
}
});
});
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
We also need a view and a controller for the login page:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">yo angular:controller login
yo angular:view login
</code></pre>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><!-- login.html -->
<form name="loginForm" ng-submit="login()" novalidate>
<div>
<label for="email">Email</label>
<input name="email" class="form-control" type="email" id="email" placeholder="Email"
ng-model="email">
</div>
<div>
<label for="password">Password</label>
<input name="password" class="form-control" type="password" id="password"
placeholder="Password" ng-model="password">
</div>
<button type="submit" class="btn btn-primary">Log in</button>
</form>
</code></pre>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">// login.js
angular.module('clientApp')
.controller('LoginCtrl', function ($scope, userService, $location, $log, $http, alertService) {
$scope.isAuthenticated = function() {
if(userService.username) {
$log.debug(userService.username);
$location.path('/dashboard');
} else {
$http.get('/app/isauthenticated')
.error(function() {
$location.path('/login');
})
.success(function(data) {
if(data.hasOwnProperty('success')) {
userService.username = data.success.user;
$location.path('/dashboard');
}
});
}
};
$scope.isAuthenticated();
$scope.login = function() {
var payload = {
email : this.email,
password : this.password
};
$http.post('/app/login', payload)
.error(function(data, status){
if(status === 400) {
angular.forEach(data, function(value, key) {
if(key === 'email' || key === 'password') {
alertService.add('danger', key + ' : ' + value);
} else {
alertService.add('danger', value.message);
}
});
} else if(status === 401) {
alertService.add('danger', 'Invalid login or password!');
} else if(status === 500) {
alertService.add('danger', 'Internal server error!');
} else {
alertService.add('danger', data);
}
})
.success(function(data){
$log.debug(data);
if(data.hasOwnProperty('success')) {
userService.username = data.success.user;
$location.path('/dashboard');
}
});
};
});
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Next we tweak the menu so that it can display user data:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><!-- index.html -->
<div class="collapse navbar-collapse" id="js-navbar-collapse" ng-controller="MenuCtrl">
<ul class="nav navbar-nav pull-right" ng-hide="isLoggedIn">
<li><a ng-href="/#/signup">Sign up!</a></li>
<li><a ng-href="/#/login">Login</a></li>
</ul>
<div class="btn-group pull-right acc-button" ng-show="isLoggedIn">
<button type="button" class="btn btn-default">{{ username }}</button>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"
aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a ng-href="/#/dashboard">Dashboard</a></li>
<li class="divider"></li>
<li><a href="#" ng-click="logout()">Logout</a></li>
</ul>
</div>
</div>
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Now if you log in into the application, you should be able to see the following screen:</div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<img alt="" src="https://uploads.toptal.io/blog/image/91223/toptal-blog-image-1432641387047.2-cb79bc93f59b460286f8868e653f2fff.jpg" style="border: 0px; box-sizing: border-box; display: block; margin: 0px auto 7px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" /></div>
<h3 id="adding-posts" style="border: 0px; box-sizing: border-box; color: #3863a0; font-size: 1.3em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Adding Posts</h3>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Now that we have basic signup and authentication mechanisms in place, we can get down to implementing the posting functionality. Let’s add a new view and controller for adding posts.</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">yo angular:view addpost
</code></pre>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><!-- addpost.html -->
<form name="postForm" ng-submit="post()" novalidate>
<div>
<label for="subject">Subject</label>
<input name="subject" class="form-control" type="subject" id="subject" placeholder="Subject"
ng-model="subject">
</div>
<div>
<label for="content">Post</label>
<textarea name="content" class="form-control" id="content" placeholder="Content"
ng-model="content"></textarea>
</div>
<button type="submit" class="btn btn-primary">Submit post</button>
</form>
</code></pre>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">yo angular:controller addpost
</code></pre>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">// addpost.js
angular.module('clientApp')
.controller('AddpostCtrl', function ($scope, $http, alertService, $location) {
$scope.post = function() {
var payload = {
subject : $scope.subject,
content: $scope.content
};
$http.post('/app/post', payload)
.error(function(data, status) {
if(status === 400) {
angular.forEach(data, function(value, key) {
if(key === 'subject' || key === 'content') {
alertService.add('danger', key + ' : ' + value);
} else {
alertService.add('danger', value.message);
}
});
} else if(status === 401) {
$location.path('/login');
} else if(status === 500) {
alertService.add('danger', 'Internal server error!');
} else {
alertService.add('danger', data);
}
})
.success(function(data) {
$scope.subject = '';
$scope.content = '';
alertService.add('success', data.success.message);
});
};
});
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Then we update “app.js” to include:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">.when('/addpost', {
templateUrl: 'views/addpost.html',
controller: 'AddpostCtrl'
})
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Next, we modify “index.html” to add a link for our “addpost” view on the dashboard menu:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><ul class="dropdown-menu" role="menu">
<li><a ng-href="/#/dashboard">Dashboard</a></li>
<li><a ng-href="/#/addpost">Add post</a></li>
<li class="divider"></li>
<li><a href="#" ng-click="logout()">Logout</a></li>
</ul>
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Now on the Play application side, let’s create a new controller Post with addPost method:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-comment" style="border: 0px; box-sizing: border-box; color: #93a1a1; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">// Post.java</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-class" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">Post</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">extends</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">Controller</span> {</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> Result <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">addPost</span>() {
Form<PostForm> postForm = Form.form(PostForm.class).bindFromRequest();
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span> (postForm.hasErrors()) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> badRequest(postForm.errorsAsJson());
} <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">else</span> {
BlogPost newBlogPost = <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">new</span> BlogPost();
newBlogPost.commentCount = <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">0</span>L;
newBlogPost.subject = postForm.get().subject;
newBlogPost.content = postForm.get().content;
newBlogPost.user = getUser();
newBlogPost.save();
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> ok(Application.buildJsonResponse(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"success"</span>, <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"Post added successfully"</span>));
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">private</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> User <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">getUser</span>() {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> User.findByEmail(session().get(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"username"</span>));
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> <span class="hljs-class" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">PostForm</span> {</span>
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Constraints</span>.Required
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Constraints</span>.MaxLength(<span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">255</span>)
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> String subject;
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Constraints</span>.Required
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> String content;
}
}
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Add a new entry to the routes file to be able to handle newly added methods in routing:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">POST /app/post controllers.Post.addPost
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
At this point, you should be able to add new posts.</div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<br /></div>
<h3 id="displaying-posts" style="border: 0px; box-sizing: border-box; color: #3863a0; font-size: 1.3em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Displaying Posts</h3>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Adding posts have little value, if we can’t display them. What we want to do is list all posts on the main page. We begin by adding a new method in our application controller:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-comment" style="border: 0px; box-sizing: border-box; color: #93a1a1; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">// Application.java</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> Result <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">getPosts</span>() {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> ok(Json.toJson(BlogPost.find.findList()));
}
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
And registering it in our routes file:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">GET /app/posts controllers.Application.getPosts
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Next, in our AngularJS application we modify our main controller:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-js hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-comment" style="border: 0px; box-sizing: border-box; color: #93a1a1; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">// main.js</span>
angular.module(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'clientApp'</span>)
.controller(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'MainCtrl'</span>, <span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span> <span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">($scope, $http)</span> {</span>
$scope.getPosts = <span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">()</span> {</span>
$http.get(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'app/posts'</span>)
.success(<span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">(data)</span> {</span>
$scope.posts = data;
});
};
$scope.getPosts();
});
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Finally, remove everything from “main.html” and add this:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-html hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"panel panel-default"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ng-repeat</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"post in posts"</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"panel-body"</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">h4</span>></span>{{ post.subject }}<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">h4</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">p</span>></span>
{{ post.content }}
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">p</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"panel-footer"</span>></span>Post by: {{ post.user.email }} | <span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">a
</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ng-href</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"/#/viewpost/{{ post.id }}"</span>></span>Comments
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">span</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"badge"</span>></span>{{ post.commentCount }}<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">span</span>></span><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">a</span>></span><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span>></span>
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Now if you load your application home page you should be seeing something similar to this:</div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<span style="font-size: 1.2em;">We should also probably have a separate view for individual posts.</span></div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">yo angular:controller viewpost
yo angular:view viewpost
</code></pre>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-js hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-comment" style="border: 0px; box-sizing: border-box; color: #93a1a1; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">// viewpost.js</span>
angular.module(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'clientApp'</span>)
.controller(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'ViewpostCtrl'</span>, <span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span> <span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">($scope, $http, alertService, userService, $location)</span> {</span>
$scope.user = userService;
$scope.params = $routeParams;
$scope.postId = $scope.params.postId;
$scope.viewPost = <span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">()</span> {</span>
$http.get(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'/app/post/'</span> + $scope.postId)
.error(<span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">(data)</span> {</span>
alertService.add(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'danger'</span>, data.error.message);
})
.success(<span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">(data)</span> {</span>
$scope.post = data;
});
};
$scope.viewPost();
});
</code></pre>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><!-- viewpost.html -->
<div class="panel panel-default" ng-show="post">
<div class="panel-body">
<h4>{{ post.subject }}</h4>
<p>
{{ post.content }}
</p>
</div>
<div class="panel-footer">Post by: {{ post.user.email }} | Comments
<span class="badge">{{ post.commentCount }}</span></a></div>
</div>
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
And the AngularJS route:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">app.js:
.when('/viewpost/:postId', {
templateUrl: 'views/viewpost.html',
controller: 'ViewpostCtrl'
})
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Like before, we add a new method to our application controller:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">// Application.java
public static Result getPost(Long id) {
BlogPost blogPost = BlogPost.findBlogPostById(id);
if(blogPost == null) {
return notFound(buildJsonResponse("error", "Post not found"));
}
return ok(Json.toJson(blogPost));
}
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
… And a new route:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">GET /app/post/:id controllers.Application.getPost(id: Long)
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Now if you navigate to http://localhost:9000/#/viewpost/1, you will be able to load a view for a particular post. Next, let’s add the ability to see user’s posts in the dashboard:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-js hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-comment" style="border: 0px; box-sizing: border-box; color: #93a1a1; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">// dashboard.js</span>
angular.module(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'clientApp'</span>)
.controller(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'DashboardCtrl'</span>, <span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span> <span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">($scope, $log, $http, alertService, $location)</span> {</span>
$scope.loadPosts = <span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">()</span> {</span>
$http.get(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'/app/userposts'</span>)
.error(<span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">(data, status)</span> {</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span>(status === <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">401</span>) {
$location.path(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'/login'</span>);
} <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">else</span> {
alertService.add(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'danger'</span>, data.error.message);
}
})
.success(<span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">(data)</span> {</span>
$scope.posts = data;
});
};
$scope.loadPosts();
});
</code></pre>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-html hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-comment" style="border: 0px; box-sizing: border-box; color: #93a1a1; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><!-- dashboard.html --></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">h4</span>></span>My Posts<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">h4</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ng-hide</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"posts.length"</span>></span>No posts yet. <span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">a</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ng-href</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"/#/addpost"</span>></span>Add a post<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">a</span>></span><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"panel panel-default"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ng-repeat</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"post in posts"</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"panel-body"</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">a</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ng-href</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"/#/viewpost/{{ post.id }}"</span>></span>{{ post.subject }}<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">a</span>></span> | Comments
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">span</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"badge"</span>></span>{{ post.commentCount }}<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">span</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span>></span>
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Also add a new method to Post controller, followed by a route corresponding to this method:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-comment" style="border: 0px; box-sizing: border-box; color: #93a1a1; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">// Post.java</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> Result <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">getUserPosts</span>() {
User user = getUser();
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span>(user == <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">null</span>) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> badRequest(Application.buildJsonResponse(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"error"</span>, <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"No such user"</span>));
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> ok(Json.toJson(BlogPost.findBlogPostsByUser(user)));
}
</code></pre>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">GET /app/userposts controllers.Post.getUserPosts
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Now when you create posts, they will be listed on the dashboard:</div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<img alt="" src="https://uploads.toptal.io/blog/image/91226/toptal-blog-image-1432641485326.9-66f4c544cd11e69ccd8dae955273823f.jpg" style="border: 0px; box-sizing: border-box; display: block; margin: 0px auto 7px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" /></div>
<h3 id="commenting-functionality" style="border: 0px; box-sizing: border-box; color: #3863a0; font-size: 1.3em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Commenting Functionality</h3>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
To implement commenting functionality, we will begin by adding a new method in Post controller:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-comment" style="border: 0px; box-sizing: border-box; color: #93a1a1; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">// Post.java</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> Result <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">addComment</span>() {
Form<CommentForm> commentForm = Form.form(CommentForm.class).bindFromRequest();
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span> (commentForm.hasErrors()) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> badRequest(commentForm.errorsAsJson());
} <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">else</span> {
PostComment newComment = <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">new</span> PostComment();
BlogPost blogPost = BlogPost.findBlogPostById(commentForm.get().postId);
blogPost.commentCount++;
blogPost.save();
newComment.blogPost = blogPost;
newComment.user = getUser();
newComment.content = commentForm.get().comment;
newComment.save();
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> ok(Application.buildJsonResponse(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"success"</span>, <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"Comment added successfully"</span>));
}
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> <span class="hljs-class" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">CommentForm</span> {</span>
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Constraints</span>.Required
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> Long postId;
<span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Constraints</span>.Required
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> String comment;
}
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
And as always, we need to register a new route for this method:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">POST /app/comment controllers.Post.addComment
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
In our AngularJS application, we add the following to “viewpost.js”:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-js hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">$scope.addComment = <span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">()</span> {</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">var</span> payload = {
postId: $scope.postId,
comment: $scope.comment
};
$http.post(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'/app/comment'</span>, payload)
.error(<span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">(data, status)</span> {</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span>(status === <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">400</span>) {
angular.forEach(data, <span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">(value, key)</span> {</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span>(key === <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'comment'</span>) {
alertService.add(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'danger'</span>, key + <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">' : '</span> + value);
} <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">else</span> {
alertService.add(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'danger'</span>, value.message);
}
});
} <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">else</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span>(status === <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">401</span>) {
$location.path(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'/login'</span>);
} <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">else</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span>(status === <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">500</span>) {
alertService.add(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'danger'</span>, <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'Internal server error!'</span>);
} <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">else</span> {
alertService.add(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'danger'</span>, data);
}
})
.success(<span class="hljs-function" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="hljs-params" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">(data)</span> {</span>
alertService.add(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">'success'</span>, data.success.message);
$scope.comment = <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">''</span>;
$scope.viewPost();
});
};
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
And finally add the following lines to “viewpost.html”:</div>
<pre style="border: 0px; box-sizing: border-box; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-html hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"well"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ng-repeat</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"comment in post.comments"</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">span</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"label label-default"</span>></span>By: {{ comment.user.email }}<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">span</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">br</span>/></span>
{{ comment.content }}
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ng-hide</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"user.username || !post"</span>></span><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">h4</span>></span><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">a</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ng-href</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"/#/login"</span>></span>Login<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">a</span>></span> to comment<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">h4</span>></span><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">form</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">name</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"addCommentForm"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ng-submit</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"addComment()"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">novalidate</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ng-show</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"user.username"</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span>></span><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">h4</span>></span>Add comment<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">h4</span>></span><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">label</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">for</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"comment"</span>></span>Comment<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">label</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">textarea</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">name</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"comment"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"form-control"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">id</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"comment"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">placeholder</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"Comment"</span>
<span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ng-model</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"comment"</span>></span><span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">textarea</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">div</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">button</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">type</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"submit"</span> <span class="hljs-attribute" style="border: 0px; box-sizing: border-box; color: #b58900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">class</span>=<span class="hljs-value" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"btn btn-primary"</span>></span>Add comment<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">button</span>></span>
<span class="hljs-tag" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"></<span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">form</span>></span>
</code></pre>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Now if you open any post, you will be able to add and view comments.</div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<img alt="" src="https://uploads.toptal.io/blog/image/91227/toptal-blog-image-1432641507343.3-d2529e37f8c21d63aff845572ba2275b.jpg" style="border: 0px; box-sizing: border-box; display: block; margin: 0px auto 7px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" /></div>
<h2 id="whats-next" style="border: 0px; box-sizing: border-box; color: #3863a0; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
What’s Next?</h2>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
In this tutorial, we have built an AngularJS blog with a Play application serving as a REST API back-end. Although the application lacks robust data validation (especially on the client side) and security, these topics were out of the scope of this tutorial. It was aiming to demonstrate one of the many possible ways of building an application of this kind. For convenience, the source code of this application has been uploaded to <a href="https://github.com/dsinyakov/angularjs-play-blog-app" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">a GitHub repository</a>.</div>
<div style="border: 0px; box-sizing: border-box; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
If you find this combination of AngularJS and Play in web application development interesting, I highly recommend you review the following topics further:</div>
<ul style="border: 0px; box-sizing: border-box; font-size: 1.2em; list-style: none; margin: 0px 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: border-box; line-height: 1.5em; list-style-type: disc; margin: 0px 0px 0.75em 30px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><a href="https://docs.angularjs.org/" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">AngularJS documentation</a></li>
<li style="border: 0px; box-sizing: border-box; line-height: 1.5em; list-style-type: disc; margin: 0px 0px 0.75em 30px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><a href="https://www.playframework.com/documentation/2.3.x/Home" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">Play documentation</a></li>
<li style="border: 0px; box-sizing: border-box; line-height: 1.5em; list-style-type: disc; margin: 0px 0px 0.75em 30px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><a href="https://github.com/jamesward/play-rest-security" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">Recommended security approach in one page JS app with Play as back-end</a> (contains example)</li>
<li style="border: 0px; box-sizing: border-box; line-height: 1.5em; list-style-type: disc; margin: 0px 0px 0.75em 30px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><a href="http://www.thebuzzmedia.com/designing-a-secure-rest-api-without-oauth-authentication/" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">Secure REST API without OAuth</a></li>
<li style="border: 0px; box-sizing: border-box; line-height: 1.5em; list-style-type: disc; margin: 0px 0px 0.75em 30px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><a href="http://securesocial.ws/" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">Ready Play authentication plug-in</a> (might be not fully usable for single-page JavaScript applications, but can be used as a good example)</li>
</ul>
<div class="blog_author_big_banner is-active" data-ga-action="ClickedOnHireTheAuthor_bottom" data-ga-label="building-modern-web-applications-with-angularjs-and-play-framework" data-view="content#bottom_banner" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<h2 style="border: 0px; box-sizing: border-box; color: #3863a0; line-height: 1.3em; margin: 0px 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<br /></h2>
</div>
</div>
</div>
</div>
<div class="two_columns_layout-extra" style="border: 0px; box-sizing: border-box; display: flex; flex-basis: 250px; flex-shrink: 0; margin: 0px 10px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<div class="blog-block-wrapper" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; position: relative; vertical-align: baseline; width: 250px;">
<div class="blog-block-header" style="border: 0px; box-sizing: border-box; color: darkgrey; font-size: 12px; margin: 0px 0px 15px; min-height: 0px; min-width: 0px; padding: 0px; text-transform: uppercase; vertical-align: baseline;">
<br /></div>
<div class="blog-block" style="background: rgb(255, 255, 255); border-color: initial; border-image: initial; border-style: initial; border-width: 0px 3px 0px 0px; box-sizing: border-box; margin: 0px 0px 35px; min-height: 0px; min-width: 0px; overflow: hidden; padding: 0px; vertical-align: baseline;">
<div class="blog-block-row" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 15px 20px; vertical-align: baseline;">
<div class="embeddable_form-wrapper is-horizontal" data-role="blog_subscribe" data-view="blog_subscribe#form" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<form action="https://www.toptal.com/blog/subscription" class="embeddable_form" data-entity="blog_subscription" data-remote="" data-view="form#form" method="post" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<div class="embeddable_form-step is-email_form is-current" style="border: 0px; box-sizing: border-box; display: flex; flex-wrap: wrap; height: auto; margin: 0px; min-height: 0px; min-width: 0px; overflow: visible; padding: 0px; vertical-align: baseline;">
<div class="embeddable_form-row is-label" style="border: 0px; box-sizing: border-box; flex-basis: 100%; margin: 0px 0px 10px; min-height: 0px; min-width: 0px; padding: 0px; position: relative; vertical-align: baseline;">
<div class="embeddable_form-label_title" style="border: 0px; box-sizing: border-box; color: #2557a1; font-size: 14px; font-weight: 700; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; text-transform: uppercase; vertical-align: baseline;">
<br /></div>
</div>
</div>
<div class="embeddable_form-step is-confirmation" data-place="@blog_subscribe" data-role="confirmation" style="border: 0px; box-sizing: border-box; height: 0px; margin: 0px; min-height: 0px; min-width: 0px; overflow: hidden; padding: 0px; vertical-align: baseline;">
<div class="embeddable_form-row is-label is-success" style="border: 0px; box-sizing: border-box; flex-basis: 100%; margin: 0px 0px 10px; min-height: 0px; min-width: 0px; padding: 0px; position: relative; vertical-align: baseline; width: 210px;">
<div class="embeddable_form-label_title" style="border: 0px; box-sizing: border-box; color: #2557a1; font-size: 14px; font-weight: 700; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; text-transform: uppercase; vertical-align: baseline;">
</div>
<div class="embeddable_form-label" style="border: 0px; box-sizing: border-box; color: grey; font-size: 14px; line-height: 19px; margin: 0px 0px 10px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
</div>
</div>
<div class="embeddable_form-row is-success" style="border: 0px; box-sizing: border-box; flex-basis: 100%; margin: 0px 0px 10px; min-height: 0px; min-width: 0px; padding: 0px; position: relative; vertical-align: baseline; width: 210px;">
<div class="embeddable_form-label is-header" style="border: 0px; box-sizing: border-box; color: grey; font-size: 14px; line-height: 19px; margin: 0px 0px 10px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
</div>
<div class="embeddable_form-label" style="border: 0px; box-sizing: border-box; color: grey; font-size: 14px; line-height: 19px; margin: 0px 0px 10px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<a data-role="preferences_link" href="https://www.toptal.com/java/building-modern-web-applications-with-angularjs-and-play-framework#" style="border: 0px; box-sizing: border-box; color: #3863a0; display: inline; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; text-decoration: none; transition: color 150ms, transform, text-shadow, -webkit-transform; vertical-align: baseline;"></a></div>
</div>
<div class="embeddable_form-row is-success" style="border: 0px; box-sizing: border-box; flex-basis: 100%; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; position: relative; vertical-align: baseline; width: 210px;">
<ul class="social_share is-horizontal is-loaded" data-rss-url="https://www.toptal.com/developers/blog.rss" data-twitter-username="@toptal" data-url="https://www.toptal.com/developers/blog" data-view="layout#social_share" data-youtube-channel-url="https://www.youtube.com/channel/UCNqm_euTHZz3o5OnKhUS-oA" style="-webkit-box-direction: normal; -webkit-box-orient: horizontal; -webkit-box-pack: start; border: 0px; box-sizing: border-box; display: flex; flex-direction: row; justify-content: flex-start; list-style: none; margin: 0px; max-width: 300px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<li class="social_share-item is-counter" style="background-color: #3863a0; border-bottom-color: rgb(236, 236, 236); border-bottom-style: solid; border-image: initial; border-left-color: rgb(236, 236, 236); border-left-style: solid; border-radius: 4px 0px 0px 4px; border-right-color: rgb(56, 99, 160) !important; border-right-style: initial; border-top-color: rgb(236, 236, 236); border-top-style: solid; border-width: 1px 0px 1px 1px; box-sizing: border-box; color: white; flex-shrink: 0; height: 50px; line-height: 15px; list-style-type: none !important; margin: 0px !important; min-height: 0px; min-width: 0px; padding: 10px 0px; position: relative; text-align: center; text-shadow: rgba(0, 0, 0, 0.498039) 0px 1px 2px; transition: box-shadow 0.2s; vertical-align: baseline; width: 50px;" title="Total number of shares"><span class="social_share-item_num" data-role="counter_num" style="border: 0px; box-sizing: border-box; display: block; font-size: 14px; margin: 0px; min-height: 0px; min-width: 0px; opacity: 1; padding: 0px; transition: opacity 0.3s; vertical-align: baseline;"></span><span class="social_share-item_text" data-role="counter_text" style="border: 0px; box-sizing: border-box; display: block; font-size: 9px; margin: 0px; min-height: 0px; min-width: 0px; opacity: 1; padding: 0px; text-transform: uppercase; transition: opacity 0.3s; vertical-align: baseline;"></span></li>
<li class="social_share-item" style="border-bottom-color: rgb(236, 236, 236); border-bottom-style: solid; border-image: initial; border-left-color: rgb(236, 236, 236); border-left-style: solid; border-right-color: initial; border-right-style: initial; border-top-color: rgb(236, 236, 236); border-top-style: solid; border-width: 1px 0px 1px 1px; box-sizing: border-box; flex-shrink: 0; height: 50px; list-style-type: none !important; margin: 0px !important; min-height: 0px; min-width: 0px; padding: 0px; text-shadow: rgba(0, 0, 0, 0.498039) 0px 1px 2px; transition: box-shadow 0.2s; vertical-align: baseline; width: 50px;"><a class="social_share-item_link" data-role="link" data-track-click="SocialShareButtonClicked" data-track-default-data="{"network":"facebook"}" data-type="facebook" href="https://www.blogger.com/null" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; cursor: pointer; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" title="Share on Facebook"><img class="social_share-item_image" height="50" src="https://assets.toptal.io/assets/front/static/public/primitives/social/share_bar/facebook_dc66c9.png" style="border: 0px; box-sizing: border-box; height: 50px; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline; width: 50px;" width="50" /></a></li>
<li class="social_share-item" style="border-bottom-color: rgb(236, 236, 236); border-bottom-style: solid; border-image: initial; border-left-color: rgb(236, 236, 236); border-left-style: solid; border-right-color: initial; border-right-style: initial; border-top-color: rgb(236, 236, 236); border-top-style: solid; border-width: 1px 0px 1px 1px; box-sizing: border-box; flex-shrink: 0; height: 50px; list-style-type: none !important; margin: 0px !important; min-height: 0px; min-width: 0px; padding: 0px; text-shadow: rgba(0, 0, 0, 0.498039) 0px 1px 2px; transition: box-shadow 0.2s; vertical-align: baseline; width: 50px;"><a class="social_share-item_link" data-role="link" data-track-click="SocialShareButtonClicked" data-track-default-data="{"network":"google_plus"}" data-type="google_plus" href="https://www.blogger.com/null" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; cursor: pointer; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" title="Share on Google Plus"><img class="social_share-item_image" height="50" src="https://assets.toptal.io/assets/front/static/public/primitives/social/share_bar/google_plus_355fb0.png" style="border: 0px; box-sizing: border-box; height: 50px; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline; width: 50px;" width="50" /></a></li>
<li class="social_share-item" style="border-radius: 0px 4px 4px 0px; border: 1px solid rgb(236, 236, 236); box-sizing: border-box; flex-shrink: 0; height: 50px; list-style-type: none !important; margin: 0px !important; min-height: 0px; min-width: 0px; padding: 0px; text-shadow: rgba(0, 0, 0, 0.498039) 0px 1px 2px; transition: box-shadow 0.2s; vertical-align: baseline; width: 50px;"><a class="social_share-item_link" data-role="link" data-track-click="SocialShareButtonClicked" data-track-default-data="{"network":"twitter_follow"}" data-type="twitter_follow" href="https://www.blogger.com/null" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; cursor: pointer; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" title="Follow Toptal on Twitter"><img class="social_share-item_image" height="50" src="https://assets.toptal.io/assets/front/static/public/primitives/social/share_bar/twitter_83c6d4.png" style="border: 0px; box-sizing: border-box; height: 50px; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline; width: 50px;" width="50" /></a></li>
</ul>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="blog-block" style="background: rgb(255, 255, 255); border-color: initial; border-image: initial; border-style: initial; border-width: 0px 3px 0px 0px; box-sizing: border-box; margin: 0px 0px 35px; min-height: 0px; min-width: 0px; overflow: hidden; padding: 0px; vertical-align: baseline;">
<div class="blog-block-row" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 15px 20px; vertical-align: baseline;">
<br /><ul class="blog-relevant" style="border: 0px; box-sizing: border-box; list-style: none; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<li></li>
</ul>
</div>
</div>
</div>
</div>
</div>
Allcad Serviceshttp://www.blogger.com/profile/12867861373206421561noreply@blogger.com0tag:blogger.com,1999:blog-6237687327557176974.post-60718433940541021222017-02-16T02:29:00.000-08:002017-02-16T02:29:43.976-08:00What is custom Development and its features <div dir="ltr" style="text-align: left;" trbidi="on">
<div class="content" style="background: 0px 0px rgb(255, 255, 255); border-bottom: 1px solid rgb(195, 195, 195); border-right: 1px solid rgb(218, 218, 218); color: #444444; font-family: Verdana; font-size: 11px; margin-bottom: 10px; margin-top: 13px; min-height: 498px; padding: 15px 25px 15px 23px;">
<div class="grey last" id="overview" style="color: rgb(102, 102, 102) !important; margin-bottom: 0px !important; margin-right: 0px;">
<h2 style="font-size: 16px; font-weight: normal; line-height: 20px; margin-bottom: 0px; margin-top: -4px; padding-bottom: 0px;">
<div id="ctl00_PlaceHolderMain_RichHtmlField1__ControlWrapper_RichHtmlField" style="display: inline;">
<div style="color: #5f5f5f; font-size: 15px; line-height: 24px; padding-bottom: 0px; padding-top: 0px;">
Often, the software that suits your specific needs simply isn’t available on the market. When packaged solutions and software aren’t sufficient or flexible enough for your enterprise, AllCAD Services can custom-build to your specifications – efficiently and deliver on its promise of certainty.</div>
</div>
</h2>
</div>
<div id="main_content">
<div id="ctl00_PlaceHolderMain_RichHtmlField2__ControlWrapper_RichHtmlField" style="display: inline;">
<h3 style="color: #666666; font-size: 16px; font-weight: normal; line-height: 20px; margin-bottom: 0px; padding-bottom: 0px; text-transform: capitalize;">
Client Challenges</h3>
<ul style="margin-left: -25px;">
<li style="background-image: url("../imagesv2/li-blue.gif"); background-position: 0px 5px; background-repeat: no-repeat; list-style: none; padding-left: 10px;">Ever-evolving business and technology requirements</li>
</ul>
<div style="line-height: 18px;">
</div>
<h3 style="color: #666666; font-size: 16px; font-weight: normal; line-height: 20px; margin-bottom: 0px; padding-bottom: 0px; text-transform: capitalize;">
What AllCAD Provides</h3>
<div style="line-height: 18px;">
</div>
<ul style="margin-left: -25px;">
<li style="background-image: url("../imagesv2/li-blue.gif"); background-position: 0px 5px; background-repeat: no-repeat; list-style: none; padding-left: 10px;">Scalable and extensible architectures that supports 24/7 business availability for global customers as it reduces development cycles and risks to a minimum</li>
<li style="background-image: url("../imagesv2/li-blue.gif"); background-position: 0px 5px; background-repeat: no-repeat; list-style: none; padding-left: 10px;">Time and cost-effective customized applications that help organizations address functional gaps and achieve business goals effectively</li>
</ul>
<div style="line-height: 18px;">
</div>
<h3 style="color: #666666; font-size: 16px; font-weight: normal; line-height: 20px; margin-bottom: 0px; padding-bottom: 0px; text-transform: capitalize;">
Business Value</h3>
<div style="line-height: 18px;">
</div>
<ul style="margin-left: -25px;">
<li style="background-image: url("../imagesv2/li-blue.gif"); background-position: 0px 5px; background-repeat: no-repeat; list-style: none; padding-left: 10px;">Greater flexibility for growth</li>
<li style="background-image: url("../imagesv2/li-blue.gif"); background-position: 0px 5px; background-repeat: no-repeat; list-style: none; padding-left: 10px;">AllCAD’ proven highest-quality processes for solving complex problems, mitigating risks, and achieving rock-solid ROI </li>
</ul>
<div>
<div id="main" role="main" style="background-color: #e5e5e5; margin-bottom: 0px; min-height: 550px; overflow: hidden; position: relative; z-index: 10;">
<div class="contentcolumn" style="overflow: hidden;">
<div class="content" style="background: 0px 0px rgb(255, 255, 255); border-bottom: 1px solid rgb(195, 195, 195); border-right: 1px solid rgb(218, 218, 218); margin-bottom: 10px; margin-top: 13px; min-height: 498px; padding: 15px 25px 15px 23px;">
<ul class="results" id="thePage" style="margin-bottom: 40px; margin-left: 0px; padding-left: 0px; padding-top: 20px;">
<dt><strong>White Paper</strong>: <a href="http://www.tcs.com/resources/white_papers/Pages/Personal-Financial-Management-Customer-Engagement.aspx" style="color: #007ac2; text-decoration: none !important;">Unleash the Power of Personal Financial Management for Customer Engagement</a></dt>
By K Krithivasan and S Baskar, Banking and Financial Services, TCS<br />January 1, 2015<br />The banking industry is at the cusp of a revolution – heavily influenced by customers with growing technology prowess. Adoption and promotion of personal financial management (PFM) will help maximize customer experience and engagement with banks. Take a look at the challenges and need to embrace PFM for continuous growth.<br /><br />
<dt><strong>White Paper</strong>: <a href="http://www.tcs.com/resources/white_papers/Pages/Developing_Offline_Web_Application_Using_HTML5.aspx" style="color: #007ac2; text-decoration: none !important;">Developing Offline Web Applications using HTML5</a></dt>
By Nilachala Panigrahy, Systems Engineer, TEG, TCS<br />February 1, 2012<br />Building the applications of tomorrow with rich features requires a proper understanding of the key web standards and frameworks that are emerging today, such as HTML5, CSS3, JavaScript and jQuery.<br /><br />
<dt><strong>White Paper</strong>: <a href="http://www.tcs.com/resources/white_papers/Pages/Data_Visualization_Ext_Js34.aspx" style="color: #007ac2; text-decoration: none !important;">Data Visualization in Ext Js 3.4</a></dt>
By Kali Prasanna Mishra, Systems engineer, TEG, TCS<br />February 1, 2012<br />Ext JS is a client-side javaScript framework for the rapid development of cross-browser interactive web applications using techniques such as Ajax, DHTML and DOM scripting.<br /><br /></ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="teaserContent trans" id="teaser1" style="background: rgb(248, 248, 248); border-bottom: 1px solid rgb(195, 195, 195); border-right: 1px solid rgb(218, 218, 218); color: #444444; font-family: Verdana; font-size: 11px; margin-bottom: 10px; margin-top: 10px; padding: 5px 25px 15px 30px;">
<div class="teaser">
<h3 style="color: #7e4197; font-size: 11px; text-transform: uppercase;">
WHITE PAPERS</h3>
<h4 style="font-size: 12px; font-weight: normal; line-height: 18px; margin: 0px; padding: 0px 0px 5px;">
<a href="http://www.tcs.com/resources/white_papers/Pages/Developing_Offline_Web_Application_Using_HTML5.aspx" style="color: #007ac2; text-decoration: none !important;">Developing Offline Web Applications using HTML5</a></h4>
<div style="line-height: 18px;">
In this white paper, we discuss the development of web applications that enable users to have an experience of the web, in an offline mode, along with its advantages and limitations.</div>
<div class="more_link" style="line-height: 18px;">
<a class="right_triangle" href="http://www.tcs.com/offerings/it-services/custom-application-development/Pages/Resources.aspx?t=w" style="color: #007ac2; text-decoration: none !important;">More White Papers</a></div>
</div>
</div>
<div class="teaserContent trans" id="teaser2" style="background: rgb(248, 248, 248); border-bottom: 1px solid rgb(195, 195, 195); border-right: 1px solid rgb(218, 218, 218); color: #444444; font-family: Verdana; font-size: 11px; margin-bottom: 10px; margin-top: 10px; padding: 5px 25px 15px 30px;">
<div class="teaser">
<h3 style="color: #7e4197; font-size: 11px; text-transform: uppercase;">
WHITE PAPERS</h3>
<h4 style="font-size: 12px; font-weight: normal; line-height: 18px; margin: 0px; padding: 0px 0px 5px;">
<a href="http://www.tcs.com/resources/white_papers/Pages/Data_Visualization_Ext_Js34.aspx" style="color: #007ac2; text-decoration: none !important;">Data Visualization in Ext Js 3.4</a></h4>
<div style="line-height: 18px;">
In this white paper, we explain the capabilities of the charting package provided by Ext JS 3.4. We also discuss how to connect to a server side component like a servlet / php file / asp.net and some Ext JS concepts like store, proxy API, reader, writer, etc.</div>
<div style="line-height: 18px;">
<br /></div>
<div class="fp-slider clearfix" style="border: 0px; color: #5b554a; font-family: Arial, Helvetica, sans-serif; font-size: 13px; margin: 0px 0px 15px; padding: 0px; vertical-align: baseline;">
<div class="fp-slides-container clearfix" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
<div class="fp-nav" style="background: rgb(38, 38, 38); border: 0px; height: 12px; margin: 0px; padding: 10px 0px; text-align: center; vertical-align: baseline; width: 930px;">
<span class="fp-pager" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> <a class="" href="http://custom-software-development.biz/info-center/what-is-custom-software/#" style="background-image: url("images/featured-pager.png"); background-position: 0px 0px; border: 0px; color: #5aac45; cursor: pointer; display: inline-block; float: none; height: 12px; line-height: 1; margin: 0px 8px 0px 0px; opacity: 0.7; overflow: hidden; padding: 0px; text-indent: -999px; vertical-align: baseline; width: 12px;">1</a><a class="" href="http://custom-software-development.biz/info-center/what-is-custom-software/#" style="background-image: url("images/featured-pager.png"); background-position: 0px 0px; border: 0px; color: #5aac45; cursor: pointer; display: inline-block; float: none; height: 12px; line-height: 1; margin: 0px 8px 0px 0px; opacity: 0.7; overflow: hidden; padding: 0px; text-indent: -999px; vertical-align: baseline; width: 12px;">2</a><a class="activeSlide" href="http://custom-software-development.biz/info-center/what-is-custom-software/#" style="background-image: url("images/featured-pager.png"); background-position: 0px -112px; border: 0px; color: #5aac45; cursor: pointer; display: inline-block; float: none; height: 12px; line-height: 1; margin: 0px 8px 0px 0px; opacity: 1; overflow: hidden; padding: 0px; text-decoration: none; text-indent: -999px; vertical-align: baseline; width: 12px;">3</a><a href="http://custom-software-development.biz/info-center/what-is-custom-software/#" style="background-image: url("images/featured-pager.png"); background-position: 0px 0px; border: 0px; color: #5aac45; cursor: pointer; display: inline-block; float: none; height: 12px; line-height: 1; margin: 0px 8px 0px 0px; opacity: 0.7; overflow: hidden; padding: 0px; text-indent: -999px; vertical-align: baseline; width: 12px;">4</a></span></div>
</div>
</div>
<div id="content" style="border: 0px; color: #5b554a; float: left; font-family: Arial, Helvetica, sans-serif; font-size: 13px; margin: 0px; overflow: hidden; padding: 0px; vertical-align: baseline; width: 615px;">
<div class="post-38 page type-page status-publish hentry post page clearfix" id="post-38" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
<h2 class="title" style="border: 0px; color: #333333; font-family: Oswald, sans-serif; font-size: 16px; font-weight: normal; line-height: 16px; margin: 0px 0px 10px; padding: 0px; vertical-align: baseline;">
What is Custom Software</h2>
<div class="entry clearfix" style="border: 0px; line-height: 20px; margin: 0px; padding: 0px; vertical-align: baseline;">
<div style="border: 0px; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">
Once surfing through Internet I came across a question “What is Custom Software?” This question was posted in some e-blog for software developers and programmers. I was quite astonished since I considered that a programmer is able to differentiate between custom software and packaged software. And I came to conclusion that if programmers have no idea of this difference then I’m dead sure that it’s a dark forest for business computer user.</div>
<div style="border: 0px; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">
Let’s put it simple way, <strong style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">custom software</strong> is a computer program developed for a specific user or a group of users within a company a corporation. It is customized for needs of these people as opposed to off the shelf software, developed for absolutely different users around the world.</div>
<div style="border: 0px; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">
<em style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">Off the shelf software</em> of packaged software is as a rule available to unassociated single users or communities. For example, an application developed for Western Union would be custom for them despite of thousands of individual users around the globe. An application intended for multiple banks would be regarded as packaged software even if it will be used by one user in every bank.</div>
<div style="border: 0px; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">
What is the importance of difference between <em style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">custom software</em> and <em style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">packaged programs</em>? We can call two reasons: expenses and possible risks. Custom software includes both high cost and relatively high risks. When company decides to develop a custom software it has to cover all expenses related to software development process which often runs into quite a penny. Software engineers must be sure that price of the software under development will be enough to cover all expenses and all contingencies. While, if the software developer decides to reject a problem agreement, which is observed quite often, this software development company considers this just another problem customer and it’s a routine for them to lose the one. Certainly, they also lose reputation and favorable references. It’s not clear but many large software development companies just ignore such issues and consider only their short term losses.</div>
<div style="border: 0px; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">
In case of a packaged solution the software development company can afford to distribute costs among ongoing and prospect customers. Finally, the price is determined by the size of the potential market, market segment competition and what market can bear. As a rule this a small part of expenses required for custom software development.</div>
<div style="border: 0px; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">
So, in the light of all these fact why would anyone purchase custom software? We have pointed out two reasons: first, no packaged software will be able to meet all the requirements and needs of the customer. And the second is ambition – a customer desires to feel his needs are unique and ready to prove that with their money.</div>
<div style="border: 0px; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">
For example: some packaged solution is sold at $2,500.00 to many different users. In case of custom development it would cost circa $250,000.00. The difference is obvious.</div>
</div>
</div>
</div>
</div>
</div>
</div>
Allcad Serviceshttp://www.blogger.com/profile/12867861373206421561noreply@blogger.com0tag:blogger.com,1999:blog-6237687327557176974.post-51575475572375094302017-02-09T22:43:00.005-08:002017-02-09T22:43:53.558-08:00The Most attractive and Light weight Platform for Web Application <div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px; padding-top: 0px;">
<a href="http://angularjs.org/" style="border: none; box-sizing: border-box; color: #0085b6; outline: none; text-decoration: none;">AngularJS</a> is a great JavaScript framework that has some very compelling features for not only developers, but designers as well! In this tutorial, we will cover what I consider to be the most essential features, and how they can help make your next web application awesome.</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
To get an idea of what you can do with AngularJS, check out the range of <a href="https://codecanyon.net/tags/angularjs" style="border: none; box-sizing: border-box; color: #0085b6; outline: none; text-decoration: none;" target="_self">AngularJS items</a> on Envato Market. You can find an <a href="https://codecanyon.net/item/angular-cropper/10448716" style="border: none; box-sizing: border-box; color: #0085b6; outline: none; text-decoration: none;" target="_self">image cropper</a>, an <a href="https://codecanyon.net/item/shopnx-angularjs-ecommerce-web-application/12957259" style="border: none; box-sizing: border-box; color: #0085b6; outline: none; text-decoration: none;" target="_self">eCommerce web application</a>, a <a href="https://codecanyon.net/item/angular-jsoneditor-directive/10372938" style="border: none; box-sizing: border-box; color: #0085b6; outline: none; text-decoration: none;" target="_self">JSON editor</a>, and much more.</div>
<figure class="post_image" style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin: 30px 0px; max-width: 100%; padding: 0px; text-align: center;"><a href="https://codecanyon.net/tags/angularjs" style="border: none; box-sizing: border-box; color: #0085b6; outline: none; text-decoration: none;" target="_self"><img alt="AngularJS items on Envato Market" src="https://cms-assets.tutsplus.com/uploads/users/48/posts/14047/image/Angular.jpg" style="background: rgb(251, 251, 251); border: none; box-sizing: border-box; height: auto; margin: 1px; max-width: 100%; outline: rgb(225, 232, 237) solid 1px; padding: 10px;" /></a><figcaption style="box-sizing: border-box; color: #a3a3a3; font-size: 12px;"><a href="https://codecanyon.net/tags/angularjs" style="border: none; box-sizing: border-box; color: #0085b6; outline: none; text-decoration: none;" target="_self">AngularJS items</a> on Envato Market</figcaption></figure><h2 class="nolinks" style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 31px; line-height: 1.2em; margin: 26px 0px;">
The Elevator Pitch: AngularJS in a Nutshell</h2>
<blockquote style="background-color: #fefefe; box-sizing: border-box; color: #7e7e7e; font-family: "Helvetica Neue", Arial, sans-serif; font-size: 21px; font-style: italic; margin: 26px 40px;">
<div style="box-sizing: border-box; margin-bottom: 26px;">
AngularJS is a new, powerful, client-side technology that provides a way of accomplishing really powerful things in a way that embraces and extends HTML, CSS and JavaScript, while shoring up some of its glaring deficiencies. It is what HTML would have been, had it been built for dynamic content.</div>
</blockquote>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
In this article, we will cover a few of the most important AngularJS concepts to get the "big picture." It is my goal that, after seeing some of these features, you will be excited enough to go and build something fun with AngularJS.</div>
<h2 class="nolinks" style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 31px; line-height: 1.2em; margin: 52px 0px 26px;">
Feature 1: Two Way Data-Binding</h2>
<blockquote style="background-color: #fefefe; box-sizing: border-box; color: #7e7e7e; font-family: "Helvetica Neue", Arial, sans-serif; font-size: 21px; font-style: italic; margin: 26px 40px;">
<div style="box-sizing: border-box; margin-bottom: 26px;">
Think of your model as the single-source-of-truth for your application. Your model is where you go to to read or update anything in your application.</div>
</blockquote>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
Data-binding is probably the coolest and most useful feature in AngularJS. It will save you from writing a considerable amount of boilerplate code. A typical web application may contain up to 80% of its code base, dedicated to traversing, manipulating, and listening to the DOM. Data-binding makes this code disappear, so you can focus on your application.</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
Think of your model as the single-source-of-truth for your application. Your model is where you go to to read or update anything in your application. The data-binding directives provide a projection of your model to the application view. This projection is seamless, and occurs without any effort from you.</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
Traditionally, when the model changes, the developer is responsible for manually manipulating the DOM elements and attributes to reflect these changes. This is a two-way street. In one direction, the model changes drive change in DOM elements. In the other, DOM element changes necessitate changes in the model. This is further complicated by user interaction, since the developer is then responsible for interpreting the interactions, merging them into a model, and updating the view. This is a very manual and cumbersome process, which becomes difficult to control, as an application grows in size and complexity.</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
There must be a better way! AngularJS' two-way data-binding handles the synchronization between the DOM and the model, and vice versa.</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
Here is a simple example, which demonstrates how to bind an input value to an <code style="background: rgb(245, 247, 248); border-radius: 3px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; font-family: "Source Code Pro", Monaco, monospace; font-size: 14px; padding: 4px 4px 1px;"><h1></code> element.</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px;">
<div class="syntaxhighlighter noskimlinks noskimwords html" id="highlighter_895281" style="background-color: rgb(245, 247, 248) !important; box-sizing: border-box; font-size: 1em !important; margin: 1em 0px !important; overflow: auto !important; position: relative !important; width: 850px;">
<table border="0" cellpadding="0" cellspacing="0" style="background: none !important; border-collapse: collapse; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-size: 14px !important; font-stretch: normal !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 850px;"><tbody style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
01</div>
<div class="line number2 index1 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
02</div>
<div class="line number3 index2 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
03</div>
<div class="line number4 index3 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
04</div>
<div class="line number5 index4 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
05</div>
<div class="line number6 index5 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
06</div>
<div class="line number7 index6 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
07</div>
<div class="line number8 index7 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
08</div>
<div class="line number9 index8 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
09</div>
<div class="line number10 index9 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
10</div>
<div class="line number11 index10 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
11</div>
<div class="line number12 index11 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
12</div>
<div class="line number13 index12 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
13</div>
<div class="line number14 index13 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
14</div>
</td><td class="code" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 812px;"><div class="container" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><!</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">doctype</code> <code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">html></code></div>
<div class="line number2 index1 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">html</code> <code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ng-app></code></div>
<div class="line number3 index2 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">head</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number4 index3 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">script</code> <code class="html color1" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: gray !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">src</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="html string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"<a href="http://code.angularjs.org/angular-1.0.0rc10.min.js" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; text-decoration: none; top: auto !important; vertical-align: baseline !important; width: auto !important;">http://code.angularjs.org/angular-1.0.0rc10.min.js</a>"</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">script</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number5 index4 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"></</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">head</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number6 index5 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">body</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number7 index6 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">div</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number8 index7 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">label</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">>Name:</</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">label</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number9 index8 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">input</code> <code class="html color1" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: gray !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">type</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="html string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"text"</code> <code class="html color1" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: gray !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ng-model</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="html string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"yourName"</code> <code class="html color1" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: gray !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">placeholder</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="html string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"Enter a name here"</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number10 index9 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">hr</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number11 index10 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">h1</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">>Hello, {{yourName}}!</</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">h1</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number12 index11 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"></</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">div</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number13 index12 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"></</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">body</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number14 index13 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"></</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">html</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
This is extremely simple to set up, and almost magical…</div>
<h2 class="nolinks" style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 31px; line-height: 1.2em; margin: 52px 0px 26px;">
Feature 2: Templates</h2>
<blockquote style="background-color: #fefefe; box-sizing: border-box; color: #7e7e7e; font-family: "Helvetica Neue", Arial, sans-serif; font-size: 21px; font-style: italic; margin: 26px 40px;">
<div style="box-sizing: border-box; margin-bottom: 26px;">
It's important to realize that at no point does AngularJS manipulate the template as strings. It's all the browser DOM.</div>
</blockquote>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
In AngularJS, a template is just plain-old-HTML. The HTML vocabulary is extended, to contain instructions on how the model should be projected into the view.</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
The HTML templates are parsed by the browser into the DOM. The DOM then becomes the input to the AngularJS compiler. AngularJS traverses the DOM template for rendering instructions, which are called directives. Collectively, the directives are responsible for setting up the data-binding for your application view.</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
It is important to realize that at no point does AngularJS manipulate the template as strings. The input to AngularJS is browser DOM and not an HTML string. The data-bindings are DOM transformations, not string concatenations or <code style="background: rgb(245, 247, 248); border-radius: 3px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; font-family: "Source Code Pro", Monaco, monospace; font-size: 14px; padding: 4px 4px 1px;">innerHTML</code> changes. Using the DOM as the input, rather than strings, is the biggest differentiation AngularJS has from its sibling frameworks. Using the DOM is what allows you to extend the directive vocabulary and build your own directives, or even abstract them into reusable components!</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
One of the greatest advantages to this approach is that it creates a tight workflow between designers and developers. Designers can mark up their HTML as they normally would, and then developers take the baton and hook in functionality, via bindings with very little effort.</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
Here is an example where I am using the <code style="background: rgb(245, 247, 248); border-radius: 3px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; font-family: "Source Code Pro", Monaco, monospace; font-size: 14px; padding: 4px 4px 1px;">ng-repeat</code> directive to loop over the <code style="background: rgb(245, 247, 248); border-radius: 3px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; font-family: "Source Code Pro", Monaco, monospace; font-size: 14px; padding: 4px 4px 1px;">images</code> array and populate what is essentially an <code style="background: rgb(245, 247, 248); border-radius: 3px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; font-family: "Source Code Pro", Monaco, monospace; font-size: 14px; padding: 4px 4px 1px;">img</code> template.</div>
<pre class="brush: noskimlinks noskimwords" style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: "Source Code Pro", Monaco, monospace; font-size: 18px; overflow: hidden;">function AlbumCtrl($scope) {
scope.images = [
{"thumbnail":"img/image_01.png", "description":"Image 01 description"},
{"thumbnail":"img/image_02.png", "description":"Image 02 description"},
{"thumbnail":"img/image_03.png", "description":"Image 03 description"},
{"thumbnail":"img/image_04.png", "description":"Image 04 description"},
{"thumbnail":"img/image_05.png", "description":"Image 05 description"}
];
}</pre>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px;">
<div class="syntaxhighlighter noskimlinks noskimwords html" id="highlighter_457237" style="background-color: rgb(245, 247, 248) !important; box-sizing: border-box; font-size: 1em !important; margin: 1em 0px !important; overflow: auto !important; position: relative !important; width: 850px;">
<table border="0" cellpadding="0" cellspacing="0" style="background: none !important; border-collapse: collapse; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-size: 14px !important; font-stretch: normal !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 850px;"><tbody style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
1</div>
<div class="line number2 index1 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
2</div>
<div class="line number3 index2 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
3</div>
<div class="line number4 index3 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
4</div>
<div class="line number5 index4 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
5</div>
<div class="line number6 index5 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
6</div>
<div class="line number7 index6 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
7</div>
</td><td class="code" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 820px;"><div class="container" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">div</code> <code class="html color1" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: gray !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ng-controller</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="html string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"AlbumCtrl"</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number2 index1 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ul</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number3 index2 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">li</code> <code class="html color1" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: gray !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ng-repeat</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="html string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"image in images"</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number4 index3 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">img</code> <code class="html color1" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: gray !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ng-src</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="html string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"{{image.thumbnail}}"</code> <code class="html color1" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: gray !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">alt</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="html string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"{{image.description}}"</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number5 index4 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"></</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">li</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number6 index5 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"></</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ul</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number7 index6 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"></</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">div</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
It is also worth mentioning, as a side note, that AngularJS does not force you to learn a new syntax or extract your templates from your application.</div>
<h2 class="nolinks" style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 31px; line-height: 1.2em; margin: 52px 0px 26px;">
Feature 3: MVC</h2>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
AngularJS incorporates the basic principles behind the original MVC software design pattern into how it builds client-side web applications.</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
The MVC or Model-View-Controller pattern means a lot of different things to different people. AngularJS does not implement MVC in the traditional sense, but rather something closer to MVVM (Model-View-ViewModel).</div>
<h3 class="nolinks" style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 21px; line-height: 1.2em; margin: 26px 0px 4px;">
The Model</h3>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
The <em style="box-sizing: border-box; margin-top: 0.3em;">model</em> is simply the data in the application. The <em style="box-sizing: border-box;">model</em> is just plain old JavaScript objects. There is no need to inherit from framework classes, wrap it in proxy objects, or use special getter/setter methods to access it. The fact that we are dealing with vanilla JavaScript is a really nice feature, which cuts down on the application boilerplate.</div>
<h3 class="nolinks" style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 21px; line-height: 1.2em; margin: 26px 0px 4px;">
The ViewModel</h3>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
A <em style="box-sizing: border-box; margin-top: 0.3em;">viewmodel</em> is an object that provides specific data and methods to maintain specific views.</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
The <em style="box-sizing: border-box;">viewmodel</em> is the <code style="background: rgb(245, 247, 248); border-radius: 3px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; font-family: "Source Code Pro", Monaco, monospace; font-size: 14px; padding: 4px 4px 1px;">$scope</code> object that lives within the AngularJS application. <code style="background: rgb(245, 247, 248); border-radius: 3px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; font-family: "Source Code Pro", Monaco, monospace; font-size: 14px; padding: 4px 4px 1px;">$scope</code> is just a simple JavaScript object with a small API designed to detect and broadcast changes to its state.</div>
<h3 class="nolinks" style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 21px; line-height: 1.2em; margin: 26px 0px 4px;">
The Controller</h3>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
The <em style="box-sizing: border-box; margin-top: 0.3em;">controller</em> is responsible for setting initial state and augmenting <code style="background: rgb(245, 247, 248); border-radius: 3px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; font-family: "Source Code Pro", Monaco, monospace; font-size: 14px; padding: 4px 4px 1px;">$scope</code> with methods to control behavior. It is worth noting that the <em style="box-sizing: border-box;">controller</em> does not store state and does not interact with remote services.</div>
<h3 class="nolinks" style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 21px; line-height: 1.2em; margin: 26px 0px 4px;">
The View</h3>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
The <em style="box-sizing: border-box; margin-top: 0.3em;">view</em> is the HTML that exists after AngularJS has parsed and compiled the HTML to include rendered markup and bindings.</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
This division creates a solid foundation to architect your application. The <code style="background: rgb(245, 247, 248); border-radius: 3px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; font-family: "Source Code Pro", Monaco, monospace; font-size: 14px; padding: 4px 4px 1px;">$scope</code> has a reference to the data, the <em style="box-sizing: border-box;">controller</em> defines behavior, and the <em style="box-sizing: border-box;">view</em> handles the layout and handing off interaction to the <em style="box-sizing: border-box;">controller</em> to respond accordingly.</div>
<h2 class="nolinks" style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 31px; line-height: 1.2em; margin: 52px 0px 26px;">
Feature 4: Dependency Injection</h2>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
AngularJS has a built-in dependency injection subsystem that helps the developer by making the application easier to develop, understand, and test.</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
Dependency Injection (DI) allows you to ask for your dependencies, rather than having to go look for them or make them yourself. Think of it as a way of saying "Hey I need X', and the DI is responsible for creating and providing it for you.</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
To gain access to core AngularJS services, it is simply a matter of adding that service as a parameter; AngularJS will detect that you need that service and provide an instance for you.</div>
<pre class="brush: noskimlinks noskimwords" style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: "Source Code Pro", Monaco, monospace; font-size: 18px; overflow: hidden;"> function EditCtrl($scope, $location, $routeParams) {
// Something clever here...
}</pre>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
You are also able to define your own custom services and make those available for injection as well.</div>
<pre class="brush: noskimlinks noskimwords" style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: "Source Code Pro", Monaco, monospace; font-size: 18px; overflow: hidden;"> angular.
module('MyServiceModule', []).
factory('notify', ['$window', function (win) {
return function (msg) {
win.alert(msg);
};
}]);
function myController(scope, notifyService) {
scope.callNotify = function (msg) {
notifyService(msg);
};
}
myController.$inject = ['$scope', 'notify'];</pre>
<h2 class="nolinks" style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 31px; line-height: 1.2em; margin: 52px 0px 26px;">
Feature 5: Directives</h2>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
Directives are my personal favorite feature of AngularJS. Have you ever wished that your browser would do new tricks for you? Well, now it can! This is one of my favorite parts of AngularJS. It is also probably the most challenging aspect of AngularJS.</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
Directives can be used to create custom HTML tags that serve as new, custom widgets. They can also be used to "decorate" elements with behavior and manipulate DOM attributes in interesting ways.</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
Here is a simple example of a directive that listens for an event and updates its <code style="background: rgb(245, 247, 248); border-radius: 3px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; font-family: "Source Code Pro", Monaco, monospace; font-size: 14px; padding: 4px 4px 1px;">$scope</code>, accordingly.</div>
<pre class="brush: noskimlinks noskimwords" style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: "Source Code Pro", Monaco, monospace; font-size: 18px; overflow: hidden;"> myModule.directive('myComponent', function(mySharedService) {
return {
restrict: 'E',
controller: function($scope, $attrs, mySharedService) {
$scope.$on('handleBroadcast', function() {
$scope.message = 'Directive: ' + mySharedService.message;
});
},
replace: true,
template: '<input>'
};
});</pre>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
Then, you can use this custom directive, like so.</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px;">
<div class="syntaxhighlighter noskimlinks noskimwords html" id="highlighter_480882" style="background-color: rgb(245, 247, 248) !important; box-sizing: border-box; font-size: 1em !important; margin: 1em 0px !important; overflow: auto !important; position: relative !important; width: 850px;">
<table border="0" cellpadding="0" cellspacing="0" style="background: none !important; border-collapse: collapse; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-size: 14px !important; font-stretch: normal !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 850px;"><tbody style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(228, 228, 228) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 1px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
1</div>
</td><td class="code" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 820px;"><div class="container" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">my-component</code> <code class="html color1" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: gray !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ng-model</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="html string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"message"</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></</code><code class="html keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">my-component</code><code class="html plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: "Source Code Pro", Monaco, monospace !important; font-stretch: normal !important; height: auto !important; left: auto !important; line-height: normal !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 5px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
Creating your application as a composition of discrete components makes it incredibly easy to add, update or delete functionality as needed.</div>
<div class="post__inarticle-ad-template" style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-top: 30px;">
<div class="ad ad--inarticle" style="background: url("//static.tutsplus.com/assets/ad-pinstripe-4b75765948385770048f57fbab90fb02.png"); box-sizing: border-box; margin: 0px auto 30px; max-width: 336px; min-height: 250px;">
<div class="ad__wrapper" style="box-sizing: border-box; overflow: hidden;">
<div class="ad__content" data-google-query-id="CL7ZuLH2hNICFUwkjgodJCYCvg" id="div-gpt-1392179526912-0" style="-webkit-box-pack: center; box-sizing: border-box; display: flex; justify-content: center; margin: 0px auto; text-align: center;">
<div id="google_ads_iframe_/11757429/hub_development_inarticle_0__container__" style="border: 0pt none; box-sizing: border-box; display: inline-block; height: 280px; width: 336px;">
<iframe data-is-safeframe="true" frameborder="0" height="280" id="google_ads_iframe_/11757429/hub_development_inarticle_0" marginheight="0" marginwidth="0" name="" scrolling="no" src="https://tpc.googlesyndication.com/safeframe/1-0-5/html/container.html#xpc=sf-gdn-exp-1&p=https%3A//code.tutsplus.com" style="border-style: initial; border-width: 0px; box-sizing: border-box; max-width: 100%; vertical-align: bottom;" title="3rd party ad content" width="336"></iframe></div>
</div>
<div class="ad__label" style="box-sizing: border-box; font-size: 9.62px; margin-top: 0px; text-align: center;">
Advertisement</div>
</div>
</div>
</div>
<h2 class="nolinks" style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 31px; line-height: 1.2em; margin: 52px 0px 26px;">
Bonus Feature: Testing</h2>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
The AngularJS team feels very strongly that any code written in JavaScript needs to come with a strong set of tests. They have designed AngularJS with testability in mind, so that it makes testing your AngularJS applications as easy as possible. So there's no excuse for not doing it.</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
Given the fact that JavaScript is dynamic and interpreted, rather than compiled, it is extremely important for developers to adopt a disciplined mindset for writing tests.</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
AngularJS is written entirely from the ground up to be testable. It even comes with an end-to-end and unit test runner setup. If you would like to see this in action, go check out the angular-seed project at <a href="https://github.com/angular/angular-seed" style="border: none; box-sizing: border-box; color: #0085b6; outline: none; text-decoration: none;">https://github.com/angular/angular-seed</a>.</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
Once you have the seed project, it's a cinch to run the tests against it. Here is what the output looks like:</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px;">
<img alt="AngularJS Essentials" src="https://cdn.tutsplus.com/net/uploads/legacy/2070_civiews/test-runner.png" style="background: rgb(251, 251, 251); box-sizing: border-box; height: auto; margin: 1px; max-width: 100%; outline: rgb(225, 232, 237) solid 1px; padding: 10px; text-align: center;" width="600" /></div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #3a3a3a; font-family: Roboto, Arial, sans-serif; font-size: 18px; margin-bottom: 26px;">
The API documentation is full of end-to-end tests that do an incredible job of illustrating how a certain part of the framework should work. After a while, I found myself going straight to the tests to see how something worked, and then maybe reading the rest of the documentation to figure something out.</div>
</div>
Allcad Serviceshttp://www.blogger.com/profile/12867861373206421561noreply@blogger.com0tag:blogger.com,1999:blog-6237687327557176974.post-62780218320772798912017-01-23T02:21:00.001-08:002017-01-23T02:21:02.685-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<h4 style="background-color: #fafaf9; box-sizing: border-box; color: #111111; font-family: "Open Sans Condensed", sans-serif; font-size: 17.6px; line-height: 1; margin: 1.33em 0px; text-transform: uppercase;">
BREAKING CHANGES</h4>
<ul style="background-color: #fafaf9; box-sizing: border-box; color: #111111; font-family: Georgia, Georgia, Times, serif; font-size: 17.6px;">
<li style="box-sizing: border-box;">NativeModules IOS: Remove <code style="box-sizing: border-box; font-family: monospace, serif; font-size: 0.85em;">customDirectEventTypes</code> (<a class="commit-link" href="https://github.com/facebook/react-native/commit/aa4428cd132bb0d0dbc950b66d3b5f2a3c5b9322" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">aa4428c</tt></a>) - <a class="user-mention" href="https://github.com/javache" style="background: transparent; box-sizing: border-box; color: #333333;">@javache</a></li>
</ul>
<h4 style="background-color: #fafaf9; box-sizing: border-box; color: #111111; font-family: "Open Sans Condensed", sans-serif; font-size: 17.6px; line-height: 1; margin: 1.33em 0px; text-transform: uppercase;">
GENERAL</h4>
<h5 style="background-color: #fafaf9; box-sizing: border-box; color: #111111; font-family: "Open Sans Condensed", sans-serif; font-size: 1em; line-height: 1; margin: 1.67em 0px; text-transform: uppercase;">
BUGFIXES</h5>
<ul style="background-color: #fafaf9; box-sizing: border-box; color: #111111; font-family: Georgia, Georgia, Times, serif; font-size: 17.6px;">
<li style="box-sizing: border-box;">Navigator - Fix wrong scene transformation after pop (<a class="commit-link" href="https://github.com/facebook/react-native/commit/f64538943e180adc2180d89285fab6727eaf3982" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">f645389</tt></a>) - <a class="user-mention" href="https://github.com/sooth-sayer" style="background: transparent; box-sizing: border-box; color: #333333;">@sooth-sayer</a></li>
<li style="box-sizing: border-box;">Prevent crash when accessing child count, but child list is NULL. (<a class="commit-link" href="https://github.com/facebook/react-native/commit/bb84c37dcefe5f31fb6735cbcbbdc4051e3c08c7" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">bb84c37</tt></a>) - <a class="user-mention" href="https://github.com/dshahidehpour" style="background: transparent; box-sizing: border-box; color: #333333;">@dshahidehpour</a></li>
<li style="box-sizing: border-box;">Fix initial value of native Animated.Value (<a class="commit-link" href="https://github.com/facebook/react-native/commit/2b49eddcfd8e21bee13fd14ada9b69f3b2f1a8d6" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">2b49edd</tt></a>) - <a class="user-mention" href="https://github.com/janicduplessis" style="background: transparent; box-sizing: border-box; color: #333333;">@janicduplessis</a></li>
<li style="box-sizing: border-box;">Fix symbolication failure caused by attempt to modify frozen frame (<a class="commit-link" href="https://github.com/facebook/react-native/commit/0fe1c7a9ff84bb0d49a0fbe3de3d09d89bf1a785" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">0fe1c7a</tt></a>) - <a class="user-mention" href="https://github.com/ide" style="background: transparent; box-sizing: border-box; color: #333333;">@ide</a></li>
<li style="box-sizing: border-box;">Fix missing methods in Keyboard module (<a class="commit-link" href="https://github.com/facebook/react-native/commit/5105c09f56035df595104666e370a9fc57ca4dcd" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">5105c09</tt></a>) - <a class="user-mention" href="https://github.com/ide" style="background: transparent; box-sizing: border-box; color: #333333;">@ide</a></li>
<li style="box-sizing: border-box;">Fix NavigationCardStackPanResponder to work with native animations (<a class="commit-link" href="https://github.com/facebook/react-native/commit/ac1927653463e766e270c87bb46833af67ee1fdc" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">ac19276</tt></a>) - <a class="user-mention" href="https://github.com/janicduplessis" style="background: transparent; box-sizing: border-box; color: #333333;">@janicduplessis</a></li>
<li style="box-sizing: border-box;">Make sure xhr req header’s value is String type (<a class="commit-link" href="https://github.com/facebook/react-native/commit/f9e36a08a8de53bf9618776cee9916496d73152e" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">f9e36a0</tt></a>) - <a class="user-mention" href="https://github.com/leeight" style="background: transparent; box-sizing: border-box; color: #333333;">@leeight</a></li>
<li style="box-sizing: border-box;">Fix DebuggerWorker.js having code incompatible with node 5 (<a class="commit-link" href="https://github.com/facebook/react-native/commit/a16d72842dc80cec3bb274080c57b4d98de26ddf" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">a16d728</tt></a>) - <a class="user-mention" href="https://github.com/mhidou" style="background: transparent; box-sizing: border-box; color: #333333;">@mhidou</a></li>
</ul>
<h5 style="background-color: #fafaf9; box-sizing: border-box; color: #111111; font-family: "Open Sans Condensed", sans-serif; font-size: 1em; line-height: 1; margin: 1.67em 0px; text-transform: uppercase;">
NEW FEATURES AND ENHACEMENTS</h5>
<ul style="background-color: #fafaf9; box-sizing: border-box; color: #111111; font-family: Georgia, Georgia, Times, serif; font-size: 17.6px;">
<li style="box-sizing: border-box;">Deprecate MapView in favor of airbnb/react-native-maps (<a class="commit-link" href="https://github.com/facebook/react-native/commit/dca53feb4fc156a42b834d94beb30811325b031f" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">dca53fe</tt></a>) - <a class="user-mention" href="https://github.com/mkonicek" style="background: transparent; box-sizing: border-box; color: #333333;">@mkonicek</a></li>
<li style="box-sizing: border-box;">CSSLayout: Update CSSNodeFree for C#, Java and Objective-C (<a class="commit-link" href="https://github.com/facebook/react-native/commit/31d392678421963733f90665586e9aa3172a0cf5" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">31d3926</tt></a>) - <a class="user-mention" href="https://github.com/splhack" style="background: transparent; box-sizing: border-box; color: #333333;">@splhack</a></li>
<li style="box-sizing: border-box;">CSSLayout: Suggest the compiler to inline smaller functions (<a class="commit-link" href="https://github.com/facebook/react-native/commit/942f72416645fc7c6874b2d9f143be2d88810063" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">942f724</tt></a>) - <a class="user-mention" href="https://github.com/emilsjolander" style="background: transparent; box-sizing: border-box; color: #333333;">@emilsjolander</a></li>
<li style="box-sizing: border-box;">CSSLayout: Don’t preallocate child lists (<a class="commit-link" href="https://github.com/facebook/react-native/commit/d932c96ddc52c0e6d376bced9ecbfa042f0f73e1" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">d932c96</tt></a>) - <a class="user-mention" href="https://github.com/swolchok" style="background: transparent; box-sizing: border-box; color: #333333;">@swolchok</a></li>
<li style="box-sizing: border-box;">CSSLayout: Exposing layout cache check publicly (<a class="commit-link" href="https://github.com/facebook/react-native/commit/e7dc71ba84ee15777601c0d59d6202a5d002a1cb" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">e7dc71b</tt></a>)</li>
<li style="box-sizing: border-box;">Use native animations in TouchableBounce and TouchableOpacity (<a class="commit-link" href="https://github.com/facebook/react-native/commit/1bb323e256bb6ad7b9f757368e69cf682f71d7ac" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">1bb323e</tt></a>) - <a class="user-mention" href="https://github.com/skevy" style="background: transparent; box-sizing: border-box; color: #333333;">@skevy</a></li>
<li style="box-sizing: border-box;">Show Warning for Background Remote Debuggers (<a class="commit-link" href="https://github.com/facebook/react-native/commit/8b653cde56c132e3f32a6dd4a79ac7be65b121cd" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">8b653cd</tt></a>) - <a class="user-mention" href="https://github.com/yungsters" style="background: transparent; box-sizing: border-box; color: #333333;">@yungsters</a></li>
<li style="box-sizing: border-box;">Adding Jest preset so that people can configure Jest using react-native as preset (<a class="commit-link" href="https://github.com/facebook/react-native/commit/6d3e074dd453e8335abc61ecbf2f3d6405dcbca0" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">6d3e074</tt></a>)</li>
<li style="box-sizing: border-box;">Use yarn when available (<a class="commit-link" href="https://github.com/facebook/react-native/commit/94711bfb06e46a7742dbddf5b1b6c48ecf345495" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">94711bf</tt></a>) - <a class="user-mention" href="https://github.com/mkonicek" style="background: transparent; box-sizing: border-box; color: #333333;">@mkonicek</a></li>
<li style="box-sizing: border-box;">Fallback to JS Animation if native animated is not present (<a class="commit-link" href="https://github.com/facebook/react-native/commit/3237ade34f4eae07771f9471f14bec5486fdf1d2" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">3237ade</tt></a>) - <a class="user-mention" href="https://github.com/fkgozali" style="background: transparent; box-sizing: border-box; color: #333333;">@fkgozali</a></li>
<li style="box-sizing: border-box;">Upgrade to lodash@^4.16.6, results in faster packager and smaller npm install size (<a class="commit-link" href="https://github.com/facebook/react-native/commit/237ab33ff4981105609f0733e265695683578f3f" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">237ab33</tt></a>) - <a class="user-mention" href="https://github.com/zertosh" style="background: transparent; box-sizing: border-box; color: #333333;">@zertosh</a></li>
<li style="box-sizing: border-box;">Bunch of documentation updates, including better user experience, more detailed explanations and more. Thanks to <a class="user-mention" href="https://github.com/aybb" style="background: transparent; box-sizing: border-box; color: #333333;">@aybb</a>, <a class="user-mention" href="https://github.com/lacker" style="background: transparent; box-sizing: border-box; color: #333333;">@lacker</a>, <a class="user-mention" href="https://github.com/hramos" style="background: transparent; box-sizing: border-box; color: #333333;">@hramos</a> and the entire team!</li>
<li style="box-sizing: border-box;">Integration test stability: add delay before starting TimersTest (<a class="commit-link" href="https://github.com/facebook/react-native/commit/0698b2beca165dc77fb23194d7d61ac46987cc09" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">0698b2b</tt></a>) - <a class="user-mention" href="https://github.com/dlowder-salesforce" style="background: transparent; box-sizing: border-box; color: #333333;">@dlowder-salesforce</a></li>
<li style="box-sizing: border-box;">Modernize AppContainer and add rootTag in the child context (<a class="commit-link" href="https://github.com/facebook/react-native/commit/fb7fe2d4e8783232c73fc48b29ad63400a8b3420" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">fb7fe2d</tt></a>) - <a class="user-mention" href="https://github.com/fkgozali" style="background: transparent; box-sizing: border-box; color: #333333;">@fkgozali</a></li>
</ul>
<h4 style="background-color: #fafaf9; box-sizing: border-box; color: #111111; font-family: "Open Sans Condensed", sans-serif; font-size: 17.6px; line-height: 1; margin: 1.33em 0px; text-transform: uppercase;">
ANDROID</h4>
<h5 style="background-color: #fafaf9; box-sizing: border-box; color: #111111; font-family: "Open Sans Condensed", sans-serif; font-size: 1em; line-height: 1; margin: 1.67em 0px; text-transform: uppercase;">
BUGFIXES</h5>
<ul style="background-color: #fafaf9; box-sizing: border-box; color: #111111; font-family: Georgia, Georgia, Times, serif; font-size: 17.6px;">
<li style="box-sizing: border-box;">Android shouldn't dispatch onLayout if frame didn't change (<a class="commit-link" href="https://github.com/facebook/react-native/commit/d4b8ae7a8a3de314b5813e0bfcdf5fb265129d43" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">d4b8ae7</tt></a>) - <a class="user-mention" href="https://github.com/hayeah" style="background: transparent; box-sizing: border-box; color: #333333;">@hayeah</a></li>
<li style="box-sizing: border-box;">HeadlessTask: Fix memory leak (<a class="commit-link" href="https://github.com/facebook/react-native/commit/3af104fbd3ba61160ddb1868283ff4e3debe533e" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">3af104f</tt></a>)</li>
<li style="box-sizing: border-box;">Fix bug in canUseCachedMeasurement causing unneeded double measure (<a class="commit-link" href="https://github.com/facebook/react-native/commit/3c5a7ae8598f9ec80c4cd340db267b99179f7dc2" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">3c5a7ae</tt></a>) - <a class="user-mention" href="https://github.com/emilsjolander" style="background: transparent; box-sizing: border-box; color: #333333;">@emilsjolander</a></li>
<li style="box-sizing: border-box;">HeadlessTask: Fix notification task timeout crashing (<a class="commit-link" href="https://github.com/facebook/react-native/commit/3580de541db600d39d4182b59a536c69477e46d3" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">3580de5</tt></a>)</li>
<li style="box-sizing: border-box;">Queue JS calls that come in before JS bundle has started loading instead of crashing (<a class="commit-link" href="https://github.com/facebook/react-native/commit/68aeffe01f442a67a53dd0eff43e9357b0ac3b22" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">68aeffe</tt></a>) - <a class="user-mention" href="https://github.com/astreet" style="background: transparent; box-sizing: border-box; color: #333333;">@astreet</a></li>
</ul>
<h5 style="background-color: #fafaf9; box-sizing: border-box; color: #111111; font-family: "Open Sans Condensed", sans-serif; font-size: 1em; line-height: 1; margin: 1.67em 0px; text-transform: uppercase;">
NEW FEATURES AND ENHANCEMENTS</h5>
<ul style="background-color: #fafaf9; box-sizing: border-box; color: #111111; font-family: Georgia, Georgia, Times, serif; font-size: 17.6px;">
<li style="box-sizing: border-box;">Enable TLS 1.1 and TLS 1.2 on Android 4.1-4.4 (<a class="commit-link" href="https://github.com/facebook/react-native/commit/55ebb89916bd084c3c352d0f9948ae0583e583ac" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">55ebb89</tt></a>) - <a class="user-mention" href="https://github.com/fkoester" style="background: transparent; box-sizing: border-box; color: #333333;">@fkoester</a></li>
<li style="box-sizing: border-box;">Implement NativeAnimated offsets (<a class="commit-link" href="https://github.com/facebook/react-native/commit/8e81644f64b96ab4726ce37a6a328acbe4a32783" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">8e81644</tt></a>) - <a class="user-mention" href="https://github.com/ryangomba" style="background: transparent; box-sizing: border-box; color: #333333;">@ryangomba</a></li>
<li style="box-sizing: border-box;">Implement NativeAnimated modulus node (<a class="commit-link" href="https://github.com/facebook/react-native/commit/9b4927c9c444c61b8ddf3c1f17325d1b85bf6a2d" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">9b4927c</tt></a>) - <a class="user-mention" href="https://github.com/ryangomba" style="background: transparent; box-sizing: border-box; color: #333333;">@ryangomba</a></li>
<li style="box-sizing: border-box;">Remove underline colour in text inputs (<a class="commit-link" href="https://github.com/facebook/react-native/commit/6ed49341f315434ee0c2016c356aa1c3f29209c1" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">6ed4934</tt></a>) - <a class="user-mention" href="https://github.com/fred2028" style="background: transparent; box-sizing: border-box; color: #333333;">@fred2028</a></li>
<li style="box-sizing: border-box;">WebSocket: include cookies in request (<a class="commit-link" href="https://github.com/facebook/react-native/commit/be4afdde37ab6ff6ebe573821745887fd3edfb05" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">be4afdd</tt></a>) - <a class="user-mention" href="https://github.com/antoinerousseau" style="background: transparent; box-sizing: border-box; color: #333333;">@antoinerousseau</a></li>
<li style="box-sizing: border-box;">Simplify react-native overrides when building from source (<a class="commit-link" href="https://github.com/facebook/react-native/commit/cd6f9f95d2aab0b8b9ec02070b18a38a18921c91" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">cd6f9f9</tt></a>) - <a class="user-mention" href="https://github.com/mikelambert" style="background: transparent; box-sizing: border-box; color: #333333;">@mikelambert</a></li>
<li style="box-sizing: border-box;">Dont go down through JNI to figure out that no margin/padding/border/position was set (<a class="commit-link" href="https://github.com/facebook/react-native/commit/2df4faaf15f582c7145cd7f0a13aa71e2ec38d95" style="background: transparent; box-sizing: border-box; color: #333333;"><tt style="box-sizing: border-box;">2df4faa</tt></a>) - <a class="user-mention" href="https://github.com/emilsjolander" style="background: transparent; box-sizing: border-box; color: #333333;">@emilsjolander</a></li>
</ul>
<h4 style="background-color: #fafaf9; box-sizing: border-box; color: #111111; font-family: "Open Sans Condensed", sans-serif; font-size: 17.6px; line-height: 1; margin: 1.33em 0px; text-transform: uppercase;">
IOS</h4>
</div>
Allcad Serviceshttp://www.blogger.com/profile/12867861373206421561noreply@blogger.com0tag:blogger.com,1999:blog-6237687327557176974.post-54767302530616279842017-01-17T02:43:00.002-08:002017-01-17T02:43:14.240-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16px;"><br /></span>
<h2 style="text-align: left;">
<span style="background-color: white;"><span style="color: blue; font-family: arial, sans-serif;">how to Use kendo UI</span></span></h2>
<br />
<span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16px;">To </span><b style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16px;">use Kendo UI</b><span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16px;"> in your project, include the required JavaScript and CSS files. Step 1 Extract the /js and /styles directories from the bundle archive and copy them to your web application root directory. Step 2 Include the </span><b style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16px;">Kendo UI</b><span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16px;"> JavaScript and CSS files in the head tag of your HTML document.</span></div>
Allcad Serviceshttp://www.blogger.com/profile/12867861373206421561noreply@blogger.com0tag:blogger.com,1999:blog-6237687327557176974.post-8363613639846963752017-01-17T02:41:00.003-08:002017-01-17T02:41:52.211-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16px;"><br /></span>
<h2 style="text-align: left;">
<span style="background-color: white;"><span style="color: blue; font-family: arial, sans-serif;">how to use angularjs with web application</span></span></h2>
<span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16px;"><br /></span>
<span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16px;">To start serving the </span><b style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16px;">application</b><span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16px;">, double click on “serve”. This should immediately open your default </span><b style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16px;">web</b><span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16px;"> browser and point it to a localhost address. You should see a stub </span><b style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16px;">AngularJS</b><span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16px;"> page with Yeoman's logo on it. Next, we need to launch our back-end </span><b style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16px;">application</b><span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16px;"> server.</span></div>
Allcad Serviceshttp://www.blogger.com/profile/12867861373206421561noreply@blogger.com0tag:blogger.com,1999:blog-6237687327557176974.post-55288884035538143322017-01-17T02:36:00.001-08:002017-01-17T02:36:25.246-08:00How to learn LESS<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="docs-section" style="box-sizing: border-box; color: #333333; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">
<div class="page-header" style="border-bottom: 1px solid rgb(238, 238, 238); box-sizing: border-box; margin: 40px 0px 20px; padding-bottom: 9px;">
<h1 class="docs-heading" style="box-sizing: border-box; color: inherit; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 38px; font-weight: 500; line-height: 1.1; margin: 30px 0px 15px -60px; padding-left: 60px; position: relative;">
Getting Started<span class="anchor-target" id="getting-started" style="box-sizing: border-box; margin-top: -80px; padding-top: 80px; position: absolute;"></span><a class="anchor glyphicon glyphicon-link" href="http://lesscss.org/#getting-started" name="getting-started" style="-webkit-font-smoothing: antialiased; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; bottom: 0px; box-sizing: border-box; display: inline-block; font-family: "Glyphicons Halflings"; font-size: 18px; left: 0px; line-height: 1; padding: 10px 10px 10px 25px; position: absolute; text-decoration: none; top: auto; width: 60px;"></a></h1>
</div>
<div style="box-sizing: border-box; margin-bottom: 10px;">
Less is a CSS pre-processor, meaning that it extends the CSS language, adding features that allow variables, mixins, functions and many other techniques that allow you to make CSS that is more maintainable, themeable and extendable.</div>
<div style="box-sizing: border-box; margin-bottom: 10px;">
Less runs inside Node, in the browser and inside Rhino. There are also many 3rd party tools that allow you to compile your files and watch for changes. The quickest place for first experiments with less is our <a href="http://lesscss.org/less-preview/" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; box-sizing: border-box; color: #43759e; text-decoration: none;">online editor</a>.</div>
<div style="box-sizing: border-box; margin-bottom: 10px;">
For example:</div>
<pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;"><code class="lang-less" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: #657b83; display: block; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: inherit; padding: 0.5em;"><span class="hljs-variable" style="box-sizing: border-box; color: #4b5e64;">@base:</span> <span class="hljs-hexcolor" style="box-sizing: border-box; color: #2aa198;">#f938ab</span>;
<span class="hljs-class" style="box-sizing: border-box; color: #284a80;">.box-shadow</span>(<span class="hljs-variable" style="box-sizing: border-box; color: #4b5e64;">@style</span>, <span class="hljs-variable" style="box-sizing: border-box; color: #4b5e64;">@c</span>) <span class="hljs-keyword" style="box-sizing: border-box; color: #4b5e64;">when</span> (<span class="hljs-function" style="box-sizing: border-box;">iscolor</span>(<span class="hljs-variable" style="box-sizing: border-box; color: #4b5e64;">@c</span>)) {
<span class="hljs-attribute" style="box-sizing: border-box; color: #4b5e64;">-webkit-box-shadow</span>: <span class="hljs-variable" style="box-sizing: border-box; color: #4b5e64;">@style</span> <span class="hljs-variable" style="box-sizing: border-box; color: #4b5e64;">@c</span>;
<span class="hljs-attribute" style="box-sizing: border-box; color: #4b5e64;">box-shadow</span>: <span class="hljs-variable" style="box-sizing: border-box; color: #4b5e64;">@style</span> <span class="hljs-variable" style="box-sizing: border-box; color: #4b5e64;">@c</span>;
}
<span class="hljs-class" style="box-sizing: border-box; color: #284a80;">.box-shadow</span>(<span class="hljs-variable" style="box-sizing: border-box; color: #4b5e64;">@style</span>, <span class="hljs-variable" style="box-sizing: border-box; color: #4b5e64;">@alpha</span>: <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">50%</span>) <span class="hljs-keyword" style="box-sizing: border-box; color: #4b5e64;">when</span> (<span class="hljs-function" style="box-sizing: border-box;">isnumber</span>(<span class="hljs-variable" style="box-sizing: border-box; color: #4b5e64;">@alpha</span>)) {
<span class="hljs-class" style="box-sizing: border-box; color: #284a80;">.box-shadow</span>(<span class="hljs-variable" style="box-sizing: border-box; color: #4b5e64;">@style</span>, <span class="hljs-function" style="box-sizing: border-box;">rgba</span>(<span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">0</span>, <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">0</span>, <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">0</span>, <span class="hljs-variable" style="box-sizing: border-box; color: #4b5e64;">@alpha</span>));
}
<span class="hljs-class" style="box-sizing: border-box; color: #284a80;">.box</span> {
<span class="hljs-attribute" style="box-sizing: border-box; color: #4b5e64;">color</span>: <span class="hljs-function" style="box-sizing: border-box;">saturate</span>(<span class="hljs-variable" style="box-sizing: border-box; color: #4b5e64;">@base</span>, <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">5%</span>);
<span class="hljs-attribute" style="box-sizing: border-box; color: #4b5e64;">border-color</span>: <span class="hljs-function" style="box-sizing: border-box;">lighten</span>(<span class="hljs-variable" style="box-sizing: border-box; color: #4b5e64;">@base</span>, <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">30%</span>);
<span class="hljs-tag" style="box-sizing: border-box; color: #4b5e64;">div</span> { <span class="hljs-class" style="box-sizing: border-box; color: #284a80;">.box-shadow</span>(<span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">0</span> <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">0</span> <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">5px</span>, <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">30%</span>) }
}
</code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
compiles to</div>
<pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;"><code class="lang-css" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: #657b83; display: block; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: inherit; padding: 0.5em;"><span class="hljs-class" style="box-sizing: border-box; color: #284a80;">.box</span> {
<span class="hljs-attribute" style="box-sizing: border-box; color: #4b5e64;">color</span>: <span class="hljs-hexcolor" style="box-sizing: border-box; color: #2aa198;">#fe33ac</span>;
<span class="hljs-attribute" style="box-sizing: border-box; color: #4b5e64;">border-color</span>: <span class="hljs-hexcolor" style="box-sizing: border-box; color: #2aa198;">#fdcdea</span>;
}
<span class="hljs-class" style="box-sizing: border-box; color: #284a80;">.box</span> <span class="hljs-tag" style="box-sizing: border-box; color: #4b5e64;">div</span> {
<span class="hljs-attribute" style="box-sizing: border-box; color: #4b5e64;">-webkit-box-shadow</span>: <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">0</span> <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">0</span> <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">5px</span> <span class="hljs-function" style="box-sizing: border-box;">rgba</span>(<span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">0</span>, <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">0</span>, <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">0</span>, <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">0.3</span>);
<span class="hljs-attribute" style="box-sizing: border-box; color: #4b5e64;">box-shadow</span>: <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">0</span> <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">0</span> <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">5px</span> <span class="hljs-function" style="box-sizing: border-box;">rgba</span>(<span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">0</span>, <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">0</span>, <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">0</span>, <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">0.3</span>);
}
</code></pre>
</div>
<div class="docs-section" style="box-sizing: border-box; color: #333333; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; padding-top: 40px;">
<div class="page-header" style="border-bottom: 1px solid rgb(238, 238, 238); box-sizing: border-box; margin: 40px 0px 20px; padding-bottom: 9px;">
<h1 class="docs-heading" style="box-sizing: border-box; color: inherit; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 38px; font-weight: 500; line-height: 1.1; margin: 30px 0px 15px -60px; padding-left: 60px; position: relative;">
Using Less<span class="anchor-target" id="using-less" style="box-sizing: border-box; margin-top: -80px; padding-top: 80px; position: absolute;"></span><a class="anchor glyphicon glyphicon-link" href="http://lesscss.org/#using-less" name="using-less" style="-webkit-font-smoothing: antialiased; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; bottom: 0px; box-sizing: border-box; display: inline-block; font-family: "Glyphicons Halflings"; font-size: 18px; left: 0px; line-height: 1; padding: 10px 10px 10px 25px; position: absolute; text-decoration: none; top: auto; width: 60px;"></a></h1>
</div>
<blockquote style="border-left: 4px solid rgb(238, 238, 238); box-sizing: border-box; margin: 0px 0px 20px; padding: 10px 20px;">
<div style="box-sizing: border-box; color: #7a7a7a; line-height: 1.25;">
Less can be used on the command line via npm, downloaded as a script file for the browser or used in a wide variety of third party tools. See the <a href="http://lesscss.org/usage/index.html" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; box-sizing: border-box; color: #43759e; text-decoration: none;">Usage</a> section for more detailed information.</div>
</blockquote>
<h2 class="docs-heading" style="box-sizing: border-box; color: inherit; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 31px; font-weight: 500; line-height: 1.1; margin-bottom: 15px; margin-left: -60px; margin-top: 30px; padding-left: 60px; position: relative;">
Installation<span class="anchor-target" id="using-less-installation" style="box-sizing: border-box; margin-top: -80px; padding-top: 80px; position: absolute;"></span><a class="anchor glyphicon glyphicon-link" href="http://lesscss.org/#using-less-installation" name="using-less-installation" style="-webkit-font-smoothing: antialiased; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; bottom: 0px; box-sizing: border-box; display: inline-block; font-family: "Glyphicons Halflings"; font-size: 18px; left: 0px; line-height: 1; margin-bottom: -3px; padding: 10px 10px 10px 25px; position: absolute; text-decoration: none; top: auto; width: 60px;"></a></h2>
<div style="box-sizing: border-box; margin-bottom: 10px;">
The easiest way to install Less on the server, is via npm, the <a href="http://nodejs.org/" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; box-sizing: border-box; color: #43759e; text-decoration: none;">node.js</a> package manager, as so:</div>
<pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;"><code class="lang-bash" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: #657b83; display: block; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: inherit; padding: 0.5em;">$ npm install -g less
</code></pre>
<h2 class="docs-heading" style="box-sizing: border-box; color: inherit; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 31px; font-weight: 500; line-height: 1.1; margin-bottom: 15px; margin-left: -60px; margin-top: 30px; padding-left: 60px; position: relative;">
Command-line Usage<span class="anchor-target" id="using-less-command-line-usage" style="box-sizing: border-box; margin-top: -80px; padding-top: 80px; position: absolute;"></span><a class="anchor glyphicon glyphicon-link" href="http://lesscss.org/#using-less-command-line-usage" name="using-less-command-line-usage" style="-webkit-font-smoothing: antialiased; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; bottom: 0px; box-sizing: border-box; display: inline-block; font-family: "Glyphicons Halflings"; font-size: 18px; left: 0px; line-height: 1; margin-bottom: -3px; padding: 10px 10px 10px 25px; position: absolute; text-decoration: none; top: auto; width: 60px;"></a></h2>
<div style="box-sizing: border-box; margin-bottom: 10px;">
Once installed, you can invoke the compiler from the command-line, as such:</div>
<pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;"><code class="lang-bash" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: #657b83; display: block; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: inherit; padding: 0.5em;">$ lessc styles.less
</code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
This will output the compiled CSS to <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; white-space: nowrap;">stdout</code>. To save the CSS result to a file of your choice use:</div>
<pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;"><code class="lang-bash" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: #657b83; display: block; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: inherit; padding: 0.5em;">$ lessc styles.less styles.css
</code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
To output minified CSS you can use the <a href="https://github.com/less/less-plugin-clean-css" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; box-sizing: border-box; color: #43759e; text-decoration: none;"><code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; white-space: nowrap;">clean-css</code> plugin</a>. When the plugin is installed, a minified CSS output is specified with <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; white-space: nowrap;">--clean-css</code> option:</div>
<pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;"><code class="lang-bash" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: #657b83; display: block; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: inherit; padding: 0.5em;">$ lessc --clean-css styles.less styles.min.css
</code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
To see all the command line options run <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; white-space: nowrap;">lessc</code> without parameters or see <a href="http://lesscss.org/usage/index.html" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; box-sizing: border-box; color: #43759e; text-decoration: none;">Usage</a>.</div>
<h2 class="docs-heading" style="box-sizing: border-box; color: inherit; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 31px; font-weight: 500; line-height: 1.1; margin-bottom: 15px; margin-left: -60px; margin-top: 30px; padding-left: 60px; position: relative;">
Usage in Code<span class="anchor-target" id="using-less-usage-in-code" style="box-sizing: border-box; margin-top: -80px; padding-top: 80px; position: absolute;"></span><a class="anchor glyphicon glyphicon-link" href="http://lesscss.org/#using-less-usage-in-code" name="using-less-usage-in-code" style="-webkit-font-smoothing: antialiased; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; bottom: 0px; box-sizing: border-box; display: inline-block; font-family: "Glyphicons Halflings"; font-size: 18px; left: 0px; line-height: 1; margin-bottom: -3px; padding: 10px 10px 10px 25px; position: absolute; text-decoration: none; top: auto; width: 60px;"></a></h2>
<div style="box-sizing: border-box; margin-bottom: 10px;">
You can invoke the compiler from node, as such:</div>
<pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;"><code class="lang-js" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: #657b83; display: block; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: inherit; padding: 0.5em;"><span class="hljs-keyword" style="box-sizing: border-box; color: #4b5e64;">var</span> less = <span class="hljs-built_in" style="box-sizing: border-box; color: #4b5e64;">require</span>(<span class="hljs-string" style="box-sizing: border-box; color: #2aa198;">'less'</span>);
less.render(<span class="hljs-string" style="box-sizing: border-box; color: #2aa198;">'.class { width: (1 + 1) }'</span>, <span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; color: #4b5e64;">function</span> (<span class="hljs-params" style="box-sizing: border-box;">e, output</span>) </span>{
<span class="hljs-built_in" style="box-sizing: border-box; color: #4b5e64;">console</span>.log(output.css);
});
</code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
which will output</div>
<pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;"><code class="lang-css" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: #657b83; display: block; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: inherit; padding: 0.5em;"><span class="hljs-class" style="box-sizing: border-box; color: #284a80;">.class</span> {
<span class="hljs-attribute" style="box-sizing: border-box; color: #4b5e64;">width</span>: <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">2</span>;
}
</code></pre>
<h2 class="docs-heading" style="box-sizing: border-box; color: inherit; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 31px; font-weight: 500; line-height: 1.1; margin-bottom: 15px; margin-left: -60px; margin-top: 30px; padding-left: 60px; position: relative;">
Configuration<span class="anchor-target" id="using-less-configuration" style="box-sizing: border-box; margin-top: -80px; padding-top: 80px; position: absolute;"></span><a class="anchor glyphicon glyphicon-link" href="http://lesscss.org/#using-less-configuration" name="using-less-configuration" style="-webkit-font-smoothing: antialiased; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; bottom: 0px; box-sizing: border-box; display: inline-block; font-family: "Glyphicons Halflings"; font-size: 18px; left: 0px; line-height: 1; margin-bottom: -3px; padding: 10px 10px 10px 25px; position: absolute; text-decoration: none; top: auto; width: 60px;"></a></h2>
<div style="box-sizing: border-box; margin-bottom: 10px;">
You may pass some options to the compiler:</div>
<pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;"><code class="lang-js" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: #657b83; display: block; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: inherit; padding: 0.5em;"><span class="hljs-keyword" style="box-sizing: border-box; color: #4b5e64;">var</span> less = <span class="hljs-built_in" style="box-sizing: border-box; color: #4b5e64;">require</span>(<span class="hljs-string" style="box-sizing: border-box; color: #2aa198;">'less'</span>);
less.render(<span class="hljs-string" style="box-sizing: border-box; color: #2aa198;">'.class { width: (1 + 1) }'</span>,
{
paths: [<span class="hljs-string" style="box-sizing: border-box; color: #2aa198;">'.'</span>, <span class="hljs-string" style="box-sizing: border-box; color: #2aa198;">'./lib'</span>], <span class="hljs-comment" style="box-sizing: border-box; color: #93a1a1; font-style: italic;">// Specify search paths for @import directives</span>
filename: <span class="hljs-string" style="box-sizing: border-box; color: #2aa198;">'style.less'</span>, <span class="hljs-comment" style="box-sizing: border-box; color: #93a1a1; font-style: italic;">// Specify a filename, for better error messages</span>
compress: <span class="hljs-literal" style="box-sizing: border-box; color: #2aa198;">true</span> <span class="hljs-comment" style="box-sizing: border-box; color: #93a1a1; font-style: italic;">// Minify CSS output</span>
},
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; color: #4b5e64;">function</span> (<span class="hljs-params" style="box-sizing: border-box;">e, output</span>) </span>{
<span class="hljs-built_in" style="box-sizing: border-box; color: #4b5e64;">console</span>.log(output.css);
});
</code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
See <a href="http://lesscss.org/usage/index.html" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; box-sizing: border-box; color: #43759e; text-decoration: none;">Usage</a> for more information.</div>
<h2 class="docs-heading" style="box-sizing: border-box; color: inherit; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 31px; font-weight: 500; line-height: 1.1; margin-bottom: 15px; margin-left: -60px; margin-top: 30px; padding-left: 60px; position: relative;">
Third Party Tools<span class="anchor-target" id="using-less-third-party-tools" style="box-sizing: border-box; margin-top: -80px; padding-top: 80px; position: absolute;"></span><a class="anchor glyphicon glyphicon-link" href="http://lesscss.org/#using-less-third-party-tools" name="using-less-third-party-tools" style="-webkit-font-smoothing: antialiased; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; bottom: 0px; box-sizing: border-box; display: inline-block; font-family: "Glyphicons Halflings"; font-size: 18px; left: 0px; line-height: 1; margin-bottom: -3px; padding: 10px 10px 10px 25px; position: absolute; text-decoration: none; top: auto; width: 60px;"></a></h2>
<div style="box-sizing: border-box; margin-bottom: 10px;">
See the <a href="http://lesscss.org/usage/index.html" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; box-sizing: border-box; color: #43759e; text-decoration: none;">Usage</a> section for details of other tools.</div>
<h1 class="docs-heading" style="box-sizing: border-box; color: inherit; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 38px; font-weight: 500; line-height: 1.1; margin: 30px 0px 15px -60px; padding-left: 60px; position: relative;">
Client-side Usage<span class="anchor-target" id="client-side-usage" style="box-sizing: border-box; margin-top: -80px; padding-top: 80px; position: absolute;"></span><a class="anchor glyphicon glyphicon-link" href="http://lesscss.org/#client-side-usage" name="client-side-usage" style="-webkit-font-smoothing: antialiased; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; bottom: 0px; box-sizing: border-box; display: inline-block; font-family: "Glyphicons Halflings"; font-size: 18px; left: 0px; line-height: 1; padding: 10px 10px 10px 25px; position: absolute; text-decoration: none; top: auto; width: 60px;"></a></h1>
<blockquote style="border-left: 4px solid rgb(238, 238, 238); box-sizing: border-box; margin: 0px 0px 20px; padding: 10px 20px;">
<div style="box-sizing: border-box; color: #7a7a7a; line-height: 1.25;">
Using less.js in the browser is great for development, but it's not recommended for production</div>
</blockquote>
<div style="box-sizing: border-box; margin-bottom: 10px;">
Client-side is the easiest way to get started and good for developing with Less, but in production, when performance and reliability is important, <em style="box-sizing: border-box;">we recommend pre-compiling using node.js or one of the many third party tools available</em>.</div>
<div style="box-sizing: border-box; margin-bottom: 10px;">
To start off, link your <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; white-space: nowrap;">.less</code> stylesheets with the <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; white-space: nowrap;">rel</code> attribute set to "<code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; white-space: nowrap;">stylesheet/less</code>":</div>
<pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;"><code class="lang-html" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: #657b83; display: block; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: inherit; padding: 0.5em;"><span class="hljs-tag" style="box-sizing: border-box; color: #4b5e64;"><<span class="hljs-title" style="box-sizing: border-box;">link</span> <span class="hljs-attribute" style="box-sizing: border-box;">rel</span>=<span class="hljs-value" style="box-sizing: border-box; color: #2aa198;">"stylesheet/less"</span> <span class="hljs-attribute" style="box-sizing: border-box;">type</span>=<span class="hljs-value" style="box-sizing: border-box; color: #2aa198;">"text/css"</span> <span class="hljs-attribute" style="box-sizing: border-box;">href</span>=<span class="hljs-value" style="box-sizing: border-box; color: #2aa198;">"styles.less"</span> /></span>
</code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
Next, <a href="https://github.com/less/less.js/archive/master.zip" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; box-sizing: border-box; color: #43759e; text-decoration: none;">download less.js</a> and include it in a <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; white-space: nowrap;"><script></script></code> tag in the <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; white-space: nowrap;"><head></code> element of your page:</div>
<pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;"><code class="lang-html" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: #657b83; display: block; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: inherit; padding: 0.5em;"><span class="hljs-tag" style="box-sizing: border-box; color: #4b5e64;"><<span class="hljs-title" style="box-sizing: border-box;">script</span> <span class="hljs-attribute" style="box-sizing: border-box;">src</span>=<span class="hljs-value" style="box-sizing: border-box; color: #2aa198;">"less.js"</span> <span class="hljs-attribute" style="box-sizing: border-box;">type</span>=<span class="hljs-value" style="box-sizing: border-box; color: #2aa198;">"text/javascript"</span>></span><span class="undefined" style="box-sizing: border-box;"></span><span class="hljs-tag" style="box-sizing: border-box; color: #4b5e64;"></<span class="hljs-title" style="box-sizing: border-box;">script</span>></span>
</code></pre>
<h3 class="docs-heading" style="box-sizing: border-box; color: inherit; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 24px; font-weight: 500; line-height: 1.1; margin-bottom: 15px; margin-left: -60px; margin-top: 30px; padding-left: 60px; position: relative;">
Tips<span class="anchor-target" id="client-side-usage-tips" style="box-sizing: border-box; margin-top: -80px; padding-top: 80px; position: absolute;"></span><a class="anchor glyphicon glyphicon-link" href="http://lesscss.org/#client-side-usage-tips" name="client-side-usage-tips" style="-webkit-font-smoothing: antialiased; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; bottom: 0px; box-sizing: border-box; display: inline-block; font-family: "Glyphicons Halflings"; font-size: 18px; left: 0px; line-height: 1; margin-bottom: -7px; padding: 10px 10px 10px 25px; position: absolute; text-decoration: none; top: auto; width: 60px;"></a></h3>
<ul style="box-sizing: border-box; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">Make sure you include your stylesheets <strong style="box-sizing: border-box;">before</strong> the script.</li>
<li style="box-sizing: border-box;">When you link more than one <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; white-space: nowrap;">.less</code> stylesheet each of them is compiled independently. So any variables, mixins or namespaces you define in a stylesheet are not accessible in any other.</li>
<li style="box-sizing: border-box;">Due to the same origin policy of browsers loading external resources requires <a href="http://enable-cors.org/" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; box-sizing: border-box; color: #43759e; text-decoration: none;">enabling CORS</a></li>
</ul>
<h2 class="docs-heading" style="box-sizing: border-box; color: inherit; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 31px; font-weight: 500; line-height: 1.1; margin-bottom: 15px; margin-left: -60px; margin-top: 30px; padding-left: 60px; position: relative;">
Browser Options<span class="anchor-target" id="client-side-usage-browser-options" style="box-sizing: border-box; margin-top: -80px; padding-top: 80px; position: absolute;"></span><a class="anchor glyphicon glyphicon-link" href="http://lesscss.org/#client-side-usage-browser-options" name="client-side-usage-browser-options" style="-webkit-font-smoothing: antialiased; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; bottom: 0px; box-sizing: border-box; display: inline-block; font-family: "Glyphicons Halflings"; font-size: 18px; left: 0px; line-height: 1; margin-bottom: -3px; padding: 10px 10px 10px 25px; position: absolute; text-decoration: none; top: auto; width: 60px;"></a></h2>
<div style="box-sizing: border-box; margin-bottom: 10px;">
Options are defined by setting them on a global <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; white-space: nowrap;">less</code> object <strong style="box-sizing: border-box;">before</strong> the <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; white-space: nowrap;"><script src="less.js"></script></code>:</div>
<pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;"><code class="lang-html" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: #657b83; display: block; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: inherit; padding: 0.5em;"><span class="hljs-comment" style="box-sizing: border-box; color: #93a1a1; font-style: italic;"><!-- set options before less.js script --></span>
<span class="hljs-tag" style="box-sizing: border-box; color: #4b5e64;"><<span class="hljs-title" style="box-sizing: border-box;">script</span>></span><span class="javascript" style="box-sizing: border-box;">
less = {
env: <span class="hljs-string" style="box-sizing: border-box; color: #2aa198;">"development"</span>,
<span class="hljs-keyword" style="box-sizing: border-box; color: #4b5e64;">async</span>: <span class="hljs-literal" style="box-sizing: border-box; color: #2aa198;">false</span>,
fileAsync: <span class="hljs-literal" style="box-sizing: border-box; color: #2aa198;">false</span>,
poll: <span class="hljs-number" style="box-sizing: border-box; color: #2aa198;">1000</span>,
functions: {},
dumpLineNumbers: <span class="hljs-string" style="box-sizing: border-box; color: #2aa198;">"comments"</span>,
relativeUrls: <span class="hljs-literal" style="box-sizing: border-box; color: #2aa198;">false</span>,
rootpath: <span class="hljs-string" style="box-sizing: border-box; color: #2aa198;">":/a.com/"</span>
};
</span><span class="hljs-tag" style="box-sizing: border-box; color: #4b5e64;"></<span class="hljs-title" style="box-sizing: border-box;">script</span>></span>
<span class="hljs-tag" style="box-sizing: border-box; color: #4b5e64;"><<span class="hljs-title" style="box-sizing: border-box;">script</span> <span class="hljs-attribute" style="box-sizing: border-box;">src</span>=<span class="hljs-value" style="box-sizing: border-box; color: #2aa198;">"less.js"</span>></span><span class="undefined" style="box-sizing: border-box;"></span><span class="hljs-tag" style="box-sizing: border-box; color: #4b5e64;"></<span class="hljs-title" style="box-sizing: border-box;">script</span>></span>
</code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
Or for brevity they can be set as attributes on the script and link tags (requires JSON.parse browser support or polyfill).</div>
<pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;"><code class="lang-html" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: #657b83; display: block; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: inherit; padding: 0.5em;"><span class="hljs-tag" style="box-sizing: border-box; color: #4b5e64;"><<span class="hljs-title" style="box-sizing: border-box;">script</span> <span class="hljs-attribute" style="box-sizing: border-box;">src</span>=<span class="hljs-value" style="box-sizing: border-box; color: #2aa198;">"less.js"</span> <span class="hljs-attribute" style="box-sizing: border-box;">data-poll</span>=<span class="hljs-value" style="box-sizing: border-box; color: #2aa198;">"1000"</span> <span class="hljs-attribute" style="box-sizing: border-box;">data-relative-urls</span>=<span class="hljs-value" style="box-sizing: border-box; color: #2aa198;">"false"</span>></span><span class="undefined" style="box-sizing: border-box;"></span><span class="hljs-tag" style="box-sizing: border-box; color: #4b5e64;"></<span class="hljs-title" style="box-sizing: border-box;">script</span>></span>
<span class="hljs-tag" style="box-sizing: border-box; color: #4b5e64;"><<span class="hljs-title" style="box-sizing: border-box;">link</span> <span class="hljs-attribute" style="box-sizing: border-box;">data-dump-line-numbers</span>=<span class="hljs-value" style="box-sizing: border-box; color: #2aa198;">"all"</span> <span class="hljs-attribute" style="box-sizing: border-box;">data-global-vars</span>=<span class="hljs-value" style="box-sizing: border-box; color: #2aa198;">'{ myvar: "#ddffee", mystr: "\"quoted\"" }'</span> <span class="hljs-attribute" style="box-sizing: border-box;">rel</span>=<span class="hljs-value" style="box-sizing: border-box; color: #2aa198;">"stylesheet/less"</span> <span class="hljs-attribute" style="box-sizing: border-box;">type</span>=<span class="hljs-value" style="box-sizing: border-box; color: #2aa198;">"text/css"</span> <span class="hljs-attribute" style="box-sizing: border-box;">href</span>=<span class="hljs-value" style="box-sizing: border-box; color: #2aa198;">"less/styles.less"</span>></span>
</code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
Learn more about <a href="http://lesscss.org/usage/#using-less-in-the-browser-setting-options" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; box-sizing: border-box; color: #43759e; text-decoration: none;">Browser Options</a></div>
</div>
<div class="docs-section" style="box-sizing: border-box; color: #333333; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; padding-top: 40px;">
<div class="page-header" style="border-bottom: 1px solid rgb(238, 238, 238); box-sizing: border-box; margin: 40px 0px 20px; padding-bottom: 9px;">
<h1 class="docs-heading" style="box-sizing: border-box; color: inherit; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 38px; font-weight: 500; line-height: 1.1; margin: 30px 0px 15px -60px; padding-left: 60px; position: relative;">
Get Less.js<span class="anchor-target" id="download-options" style="box-sizing: border-box; margin-top: -80px; padding-top: 80px; position: absolute;"></span><a class="anchor glyphicon glyphicon-link" href="http://lesscss.org/#download-options" name="download-options" style="-webkit-font-smoothing: antialiased; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; bottom: 0px; box-sizing: border-box; display: inline-block; font-family: "Glyphicons Halflings"; font-size: 18px; left: 0px; line-height: 1; padding: 10px 10px 10px 25px; position: absolute; text-decoration: none; top: auto; width: 60px;"></a></h1>
</div>
<h2 class="docs-heading" style="box-sizing: border-box; color: inherit; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 31px; font-weight: 500; line-height: 1.1; margin-bottom: 15px; margin-left: -60px; margin-top: 30px; padding-left: 60px; position: relative;">
Browser downloads<span class="anchor-target" id="download-options-browser-downloads" style="box-sizing: border-box; margin-top: -80px; padding-top: 80px; position: absolute;"></span><a class="anchor glyphicon glyphicon-link" href="http://lesscss.org/#download-options-browser-downloads" name="download-options-browser-downloads" style="-webkit-font-smoothing: antialiased; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; bottom: 0px; box-sizing: border-box; display: inline-block; font-family: "Glyphicons Halflings"; font-size: 18px; left: 0px; line-height: 1; margin-bottom: -3px; padding: 10px 10px 10px 25px; position: absolute; text-decoration: none; top: auto; width: 60px;"></a></h2>
<a class="btn btn-default" href="https://raw.github.com/less/less.js/v2.7.1/dist/less.min.js" style="background: none rgb(255, 255, 255); border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; cursor: pointer; display: inline-block; line-height: 1.42857; margin-bottom: 0px; padding: 6px 12px; text-align: center; text-decoration: none; user-select: none; vertical-align: middle; white-space: nowrap;">Download Less.js v2.7.1</a><br />
<div class="docs-dl-options" style="box-sizing: border-box;">
<h4 class="docs-heading" style="box-sizing: border-box; color: inherit; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 5px; margin-top: 15px;">
<a href="https://github.com/less/less.js/archive/v2.7.1.zip" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; box-sizing: border-box; color: #43759e; text-decoration: none;">Download Source Code</a><span class="anchor-target" id="download-options--download-source-code-https-github-com-less-less-js-archive-v2-7-1-zip-" style="box-sizing: border-box; margin-top: -80px; padding-top: 80px; position: absolute;"></span><a class="anchor glyphicon glyphicon-link" href="http://lesscss.org/#download-options--download-source-code-https-github-com-less-less-js-archive-v2-7-1-zip-" name="download-options--download-source-code-https-github-com-less-less-js-archive-v2-7-1-zip-" style="-webkit-font-smoothing: antialiased; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; bottom: 0px; box-sizing: border-box; display: inline-block; font-family: "Glyphicons Halflings"; left: 0px; line-height: 1; margin-bottom: -11px; padding: 10px 10px 10px 25px; position: absolute; text-decoration: none; top: auto; width: 60px;"></a></h4>
<div style="box-sizing: border-box; margin-bottom: 10px;">
Get the latest Less.js source code by downloading it directly from GitHub.</div>
<h4 class="docs-heading" style="box-sizing: border-box; color: inherit; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 5px; margin-top: 15px;">
<a href="https://github.com/less/less.js.git" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; box-sizing: border-box; color: #43759e; text-decoration: none;">Clone or Fork via GitHub</a><span class="anchor-target" id="download-options--clone-or-fork-via-github-https-github-com-less-less-js-git-" style="box-sizing: border-box; margin-top: -80px; padding-top: 80px; position: absolute;"></span><a class="anchor glyphicon glyphicon-link" href="http://lesscss.org/#download-options--clone-or-fork-via-github-https-github-com-less-less-js-git-" name="download-options--clone-or-fork-via-github-https-github-com-less-less-js-git-" style="-webkit-font-smoothing: antialiased; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; bottom: 0px; box-sizing: border-box; display: inline-block; font-family: "Glyphicons Halflings"; left: 0px; line-height: 1; margin-bottom: -11px; padding: 10px 10px 10px 25px; position: absolute; text-decoration: none; top: auto; width: 60px;"></a></h4>
<div style="box-sizing: border-box; margin-bottom: 10px;">
Fork the project and send us a pull request!</div>
<h4 class="docs-heading" style="box-sizing: border-box; color: inherit; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 5px; margin-top: 15px;">
<a href="http://bower.io/" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; box-sizing: border-box; color: #43759e; text-decoration: none;">Install with Bower</a><span class="anchor-target" id="download-options--install-with-bower-http-bower-io-" style="box-sizing: border-box; margin-top: -80px; padding-top: 80px; position: absolute;"></span><a class="anchor glyphicon glyphicon-link" href="http://lesscss.org/#download-options--install-with-bower-http-bower-io-" name="download-options--install-with-bower-http-bower-io-" style="-webkit-font-smoothing: antialiased; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; bottom: 0px; box-sizing: border-box; display: inline-block; font-family: "Glyphicons Halflings"; left: 0px; line-height: 1; margin-bottom: -11px; padding: 10px 10px 10px 25px; position: absolute; text-decoration: none; top: auto; width: 60px;"></a></h4>
<div style="box-sizing: border-box; margin-bottom: 10px;">
Install the Less.js project and JavaScript by running the following in the command line:</div>
<pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;"><code class="lang-bash" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: #657b83; display: block; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: inherit; padding: 0.5em;">bower install less
</code></pre>
</div>
<div class="cdn-options" style="box-sizing: border-box;">
<h3 class="docs-heading" style="box-sizing: border-box; color: inherit; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 24px; font-weight: 500; line-height: 1.1; margin-bottom: 15px; margin-left: -60px; margin-top: 30px; padding-left: 60px; position: relative;">
<a href="http://cdnjs.cloudflare.com/ajax/libs/less.js/2.7.1/less.min.js" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; box-sizing: border-box; color: #43759e; text-decoration: none;">Less CDN</a><span class="anchor-target" id="download-options--less-cdn-cdnjs-cloudflare-com-ajax-libs-less-js-2-7-1-less-min-js-" style="box-sizing: border-box; margin-top: -80px; padding-top: 80px; position: absolute;"></span><a class="anchor glyphicon glyphicon-link" href="http://lesscss.org/#download-options--less-cdn-cdnjs-cloudflare-com-ajax-libs-less-js-2-7-1-less-min-js-" name="download-options--less-cdn-cdnjs-cloudflare-com-ajax-libs-less-js-2-7-1-less-min-js-" style="-webkit-font-smoothing: antialiased; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; bottom: 0px; box-sizing: border-box; display: inline-block; font-family: "Glyphicons Halflings"; font-size: 18px; left: 0px; line-height: 1; margin-bottom: -7px; padding: 10px 10px 10px 25px; position: absolute; text-decoration: none; top: auto; width: 60px;"></a></h3>
<pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;"><code class="lang-html" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: #657b83; display: block; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: inherit; padding: 0.5em;"><span class="hljs-tag" style="box-sizing: border-box; color: #4b5e64;"><<span class="hljs-title" style="box-sizing: border-box;">script</span> <span class="hljs-attribute" style="box-sizing: border-box;">src</span>=<span class="hljs-value" style="box-sizing: border-box; color: #2aa198;">"//cdnjs.cloudflare.com/ajax/libs/less.js/2.7.1/less.min.js"</span>></span><span class="undefined" style="box-sizing: border-box;"></span><span class="hljs-tag" style="box-sizing: border-box; color: #4b5e64;"></<span class="hljs-title" style="box-sizing: border-box;">script</span>></span></code></pre>
</div>
</div>
</div>
Allcad Serviceshttp://www.blogger.com/profile/12867861373206421561noreply@blogger.com0tag:blogger.com,1999:blog-6237687327557176974.post-28363584214898575872017-01-17T02:28:00.002-08:002017-01-17T02:29:42.459-08:00how to create mobile application using react native<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<a href="https://koenig-media.raywenderlich.com/uploads/2016/04/ReactNative-feature-250x250.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img alt="React Native tutorial" border="0" src="https://koenig-media.raywenderlich.com/uploads/2016/04/ReactNative-feature-250x250.png" style="background-color: transparent;" /></a><span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Update note:</span> This tutorial has been updated to React Native 0.34 by Tom Elliot. The original tutorial was written by iOS Team member Colin Eberhardt.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
In this React Native Tutorial you’ll learn about a framework for building native iOS and Android applications from Facebook, based on the same principals behind their hugely popular <a href="https://facebook.github.io/react/" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">React Javascript Framework</a> for building declarative user interfaces.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Over the years there have been many frameworks using JavaScript to create iOS applications (such as <a href="http://phonegap.com/" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">PhoneGap</a> or <a href="http://www.appcelerator.com/mobile-app-development-products/" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Titanium</a>), so what makes React Native special?</div>
<ol style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 11px 30px; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px 0px 10px; outline: 0px; padding: 0px; vertical-align: baseline;">(Unlike PhoneGap) with React Native your application logic is written and runs in JavaScript, whereas your application UI is fully native; therefore you have none of the compromises typically associated with HTML5 UI.</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px 0px 10px; outline: 0px; padding: 0px; vertical-align: baseline;">Additionally (unlike Titanium), React introduces a novel, radical and highly functional approach to constructing user interfaces. In brief, the application UI is simply expressed as a function of the current application state.</li>
</ol>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
The key point with React Native is that it aims to primarily bring the power of the <a href="http://facebook.github.io/react/" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">React</a> programming model to mobile app development. It is not aiming to be a cross platform, write-once run-anywhere, tool. It is aiming to be learn-once write-anywhere. An important distinction to make. This tutorial only covers iOS, but once you’ve learned the concepts here you could port that knowledge into creating an Android app very quickly.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
If you have only ever written applications in Objective-C or Swift, you might not be particularly excited about the prospect of using JavaScript instead. Although, as a Swift developer, the second point above should pique your interest!</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Through Swift, you’ve no doubt been learning new and more functional ways to encode algorithms, and techniques that encourage transformation and immutability. However, the way in which you construct your UI is very much the same as it was when developing with Objective-C: it’s still UIKit-based and imperative.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Through intriguing concepts such as a virtual DOM and reconciliation, React brings functional programming directly to the UI layer.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This React Native tutorial takes you through the process of building an application for searching UK property listings:</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<a href="https://koenig-media.raywenderlich.com/uploads/2015/03/PropertyFinder.png" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><img alt="React Native tutorial" class="alignnone size-large wp-image-99475" height="360" src="https://koenig-media.raywenderlich.com/uploads/2015/03/PropertyFinder-700x360.png" style="border: 0px; height: auto; max-width: 100%; vertical-align: top;" width="700" /></a></div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
If you’ve never written any JavaScript before, fear not; this tutorial leads you through each and every step of the coding. React uses CSS-like properties for styling which are generally easy to read and understand, but if you need to, you can always refer to the excellent <a href="https://developer.mozilla.org/en-US/docs/Web/CSS" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Mozilla Developer Network reference</a>.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Want to learn more? Read on!</div>
<h2 style="background-color: white; border: 0px; color: #006837; font-family: Bitter, Georgia, serif; font-size: 26px; margin: -3px 0px 0px; outline: 0px; padding: 5px 0px 20px; vertical-align: baseline;">
Getting Started</h2>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
React Native uses <a href="https://nodejs.org/" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Node.js</a>, a JavaScript runtime, to build your JavaScript code. If you don’t already have Node.js installed, it’s time to get it!</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
First <a href="http://brew.sh/" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">install Homebrew</a> using the instructions on the Homebrew website, then install Node.js by executing the following in a Terminal window:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p1260631" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code1" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="console" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">brew install node</pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Next, use <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">homebrew</code> to install <a href="https://facebook.github.io/watchman/" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">watchman</a>, a file watcher from Facebook:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p1260632" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code2" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="console" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">brew install watchman</pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This is used by React Native to figure out when your code changes and rebuild accordingly. It’s like having Xcode do a build each time you save your file.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Next use npm to install the React Native Command Line Interface (CLI) tool:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p1260633" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code3" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="console" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">npm install -g react-native-cli</pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This uses the <a href="https://www.npmjs.com/" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Node Package Manager</a> to fetch the CLI tool and install it globally; npm is similar in function to <a href="https://cocoapods.org/" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">CocoaPods</a> or <a href="https://github.com/Carthage/Carthage" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Carthage</a> and is packaged with Node.js.</div>
<div class="note" style="background-color: #edf0d5; border-radius: 4px; border: 1px solid rgb(0, 0, 0); font-family: Helvetica, sans-serif; font-size: 16px; line-height: 25.88px; margin: 5px 0px 17px; outline: 0px; padding: 14px !important; vertical-align: baseline;">
The source code of the React Native framework is also <a href="https://github.com/facebook/react-native" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">available via GitHub</a> if you wish to dig deeper.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Navigate to the folder where you would like to develop your React Native application, and use the CLI tool to construct the project:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p1260634" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code4" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="console" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">react-native init PropertyFinder</pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This creates a starter-project containing everything you need to build and run a React Native application.</div>
<div class="note" style="background-color: #edf0d5; border-radius: 4px; border: 1px solid rgb(0, 0, 0); font-family: Helvetica, sans-serif; font-size: 16px; line-height: 25.88px; margin: 5px 0px 17px; outline: 0px; padding: 14px !important; vertical-align: baseline;">
If you get complaints about the version of node, make sure the one installed by brew is the one in use. Run <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">brew link --overwrite node</code> in the terminal.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
If you look at the created folders and files you will find a <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">node_modules</span> folder, which contains the React Native framework. You will also find an <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">index.ios.js</span> file, which is the skeletal app created by the CLI tool. There is also an <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">ios</span> folder, containing an Xcode project and the small amount of code required to ‘bootstrap’ your application. Finally, there are Android counterparts, although we won’t be touching on those in this tutorial.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Open the Xcode project file then build and run. The simulator will start and display the following greeting:</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<br /></div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
You might also have noticed that a terminal window has popped up, displaying the following:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p1260635" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code5" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="console" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"> ┌──────────────────────────────────────────────┐
│ Running packager on port 8081. │
│ │
│ Keep this packager running while developing on any JS projects. Feel │
│ free to close this tab and run your own packager instance if you │
│ prefer. │
│ │
│ https://github.com/facebook/react-native │
│ │
└──────────────────────────────────────────────┘
Looking for JS files in
/Users/tomelliott/Desktop/Scratch/PropertyFinder
[6:15:40 PM] <START> Building Dependency Graph
[6:15:40 PM] <START> Crawling File System
[6:15:40 PM] <START> Loading bundles layout
[6:15:40 PM] <END> Loading bundles layout (0ms)
[Hot Module Replacement] Server listening on /hot
React packager ready.
[6:15:41 PM] <END> Crawling File System (747ms)
[6:15:41 PM] <START> Building in-memory fs for JavaScript
[6:15:42 PM] <END> Building in-memory fs for JavaScript (653ms)
[6:15:42 PM] <START> Building in-memory fs for Assets
[6:15:42 PM] <END> Building in-memory fs for Assets (277ms)
[6:15:42 PM] <START> Building Haste Map
[6:15:42 PM] <START> Building (deprecated) Asset Map
[6:15:42 PM] <END> Building (deprecated) Asset Map (49ms)
[6:15:42 PM] <END> Building Haste Map (400ms)
[6:15:42 PM] <END> Building Dependency Graph (2094ms)</pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This is the React Native packager, running under node. You’ll find out what it does shortly.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Don’t close the Terminal window; just keep it running in the background. If you do close it by mistake, simply stop and re-run the project via Xcode.</div>
<div class="note" style="background-color: #edf0d5; border-radius: 4px; border: 1px solid rgb(0, 0, 0); font-family: Helvetica, sans-serif; font-size: 16px; line-height: 25.88px; margin: 5px 0px 17px; outline: 0px; padding: 14px !important; vertical-align: baseline;">
<span style="border: 0px; color: #006837; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Note</span>: One final thing before you get too deep in the code — you’re going to be writing a lot of JavaScript code in this tutorial, and Xcode is certainly not the best tool for this job! I use <a href="http://www.sublimetext.com/" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Sublime Text</a>, which is a cheap and versatile editor, but <a href="https://atom.io/" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">atom</a>, <a href="http://brackets.io/" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">brackets</a> or any other lightweight editor will do the job.</div>
<h2 style="background-color: white; border: 0px; color: #006837; font-family: Bitter, Georgia, serif; font-size: 26px; margin: -3px 0px 0px; outline: 0px; padding: 5px 0px 20px; vertical-align: baseline;">
Hello React Native</h2>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Before getting started on the property search application, you’re going to create a very simple Hello World app. You’ll be introduced to the various components and concepts as you go along.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Open <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">index.ios.js</span> in your text editor of choice and delete the current contents since you’re going to build your own app from scratch. Add the following to the start of the file:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p1260636" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code6" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'use strict'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This enables <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Strict Mode</span>, which adds improved error handling and disables some less-than-ideal JavaScript language features. In simple terms, it makes JavaScript better!</div>
<div class="note" style="background-color: #edf0d5; border-radius: 4px; border: 1px solid rgb(0, 0, 0); font-family: Helvetica, sans-serif; font-size: 16px; line-height: 25.88px; margin: 5px 0px 17px; outline: 0px; padding: 14px !important; vertical-align: baseline;">
<span style="border: 0px; color: #006837; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Note:</span> For a more detailed overview of Strict Mode, I’d encourage you to read Jon Resig’s article <a href="http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">ECMAScript 5 Strict Mode, JSON, and More</a>.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Next, add the following lines:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p1260637" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code7" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> React <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> require<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'react'</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> ReactNative <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> require<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'react-native'</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This loads the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">react</code> & <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">react-native</code> modules and assigns them to variables called <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">React</code> & <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">ReactNative</code>. React Native uses the same module loading technology as Node.js with the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">require</code> function, which is roughly equivalent to linking and importing libraries in Swift.</div>
<div class="note" style="background-color: #edf0d5; border-radius: 4px; border: 1px solid rgb(0, 0, 0); font-family: Helvetica, sans-serif; font-size: 16px; line-height: 25.88px; margin: 5px 0px 17px; outline: 0px; padding: 14px !important; vertical-align: baseline;">
<span style="border: 0px; color: #006837; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Note:</span> For more information about JavaScript modules I’d recommend reading <a href="http://addyosmani.com/writing-modular-js/" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this article by Addy Osmani</a>on writing modular JavaScript.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Just below the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">require</code> statement, add the following:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p1260638" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code8" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> styles <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> ReactNative.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">StyleSheet</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">create</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
text<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
color<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'black'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
backgroundColor<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'white'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
fontSize<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">30</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
margin<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">80</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This defines a single style that you will shortly apply to your “Hello World” text. If you’ve done any web development before, you’ll probably recognize those property names. The React Native StyleSheet class used to style the application UI is similar to the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Cascading Style Sheets (CSS)</a> used on the Web.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Now for the app itself! Still working in the same file, add the following code just beneath the style declaration above:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p1260639" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code9" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">class</span> PropertyFinderApp <span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">extends</span> React.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Component</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
render<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">return</span> React.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">createElement</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>ReactNative.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Text</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">text</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">"Hello World!"</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Yes, that’s a JavaScript class!</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Classes were introduced in ECMAScript 6 (ES6). As JavaScript is constantly evolving, developers are restricted in what they can use due to the need to maintain compatibility with older operating systems or browsers. Even though iOS 9 doesn’t fully support ES6, React Native is using a tool called <a href="https://babeljs.io/" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Babel</a> to automatically translate modern JavaScript into compatible legacy JavaScript where necessary.</div>
<div class="note" style="background-color: #edf0d5; border-radius: 4px; border: 1px solid rgb(0, 0, 0); font-family: Helvetica, sans-serif; font-size: 16px; line-height: 25.88px; margin: 5px 0px 17px; outline: 0px; padding: 14px !important; vertical-align: baseline;">
<div style="border: 0px; font-family: inherit; font-size: 1em; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; vertical-align: baseline;">
<span style="border: 0px; color: #006837; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Note:</span> If you are a web developer, you can use Babel in the browser as well! There really is no excuse for using older versions of JavaScript anymore, even when supporting legacy browsers :]</div>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">PropertyFinderApp</code> extends <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">React.Component</code>, the basic building block of the React UI. Components contain immutable properties, mutable state variables and expose a method for rendering. Your current application is quite simple and only requires a render method.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
React Native components are not UIKit classes; instead they are a lightweight equivalent. The framework takes care of transforming the tree of React components into the required native UI.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Finally, add the following to the end of the file:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606310" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code10" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">ReactNative.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">AppRegistry</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">registerComponent</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'PropertyFinder'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span> <span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">function</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span> <span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">return</span> PropertyFinderApp <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">AppRegistry</code> defines the entry point to the application and provides the root component.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Save your changes to <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">index.ios.js</span> and then return to Xcode. Ensure the <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">PropertyFinder</span> scheme is selected with one of the iPhone simulators, and then build and run your project. After a few seconds you’ll see your “Hello World” app in action:</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<br /></div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
That’s a JavaScript application running in the simulator, rendering a native UI, without a browser in sight!</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Still don’t trust me? :] Verify it for yourself: within Xcode, select <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Debug\View Debugging\Capture View Hierarchy</span> and take a look at the native view hierarchy. You will see no <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">UIWebView</code> instances anywhere! Your text is being displayed in a view called <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">RCTText</code>. But what is that? Back in Xcode select <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">File\Open Quickly…</span> and type in <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">RCTView.h</code>. Notice <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">RCTView</code> inherits directly from <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">UIView</code>. Neat!</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<a href="https://koenig-media.raywenderlich.com/uploads/2016/02/ViewDebugging.png" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><img alt="React Native tutorial" class="aligncenter size-medium wp-image-100990 bordered" height="227" src="https://koenig-media.raywenderlich.com/uploads/2016/02/ViewDebugging.png" style="border: 1px solid rgb(0, 0, 0); clear: both; display: block; height: auto; margin-bottom: 1.625em; margin-left: auto; margin-right: auto; max-width: 100%; vertical-align: top;" width="480" /></a></div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Curious as to how it all works? In Xcode open <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">AppDelegate.m</span> and locate <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">application:didFinishLaunchingWithOptions:</code>. This method constructs a <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">RCTRootView</code>, which loads the JavaScript application and renders the resultant view.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
When the application starts, the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">RCTRootView</code> loads the application from the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">index.ios</code> Javascript file.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Recall the Terminal window that was opened when you ran this application; this starts a packager and server that allows your Javascript code to be fetched, by default on port 8081. For example:</div>
<pre style="background-color: white; border: 0px; font-family: inherit; font-size: 16px; outline: 0px; padding: 0px; vertical-align: baseline;">http://localhost:8081/index.ios.bundle
</pre>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Open this URL in Safari; you’ll see the JavaScript code for your app. You should be able to find your “Hello World” code embedded among the React Native framework.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
When your app starts, this code is loaded and executed by the JavaScriptCore framework. In the case of your application, it loads the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">PropertyFinderApp</code> component, then constructs the native UIKit view. You’ll learn a bit more about this later in the tutorial.</div>
<h2 style="background-color: white; border: 0px; color: #006837; font-family: Bitter, Georgia, serif; font-size: 26px; margin: -3px 0px 0px; outline: 0px; padding: 5px 0px 20px; vertical-align: baseline;">
Hello World JSX</h2>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Your current application uses <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">React.createElement</code> to construct the simple UI for your application, which React turns into the native equivalent. While your JavaScript code is perfectly readable in its present form, a more complex UI with nested elements would rapidly become quite a mess.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Make sure the app is still running, then return to your text editor to edit <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">index.ios.js</span>. Modify the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">return</code> statement of your component’s render method as follows:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606311" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code11" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">return</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>ReactNative.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Text</span> style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">text</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>Hello World <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>Again<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>ReactNative.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Text</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">>;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This is <a href="http://facebook.github.io/react/docs/jsx-in-depth.html" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">JSX</a>, or JavaScript syntax extension, which mixes HTML-like syntax directly in your JavaScript code; if you’re already a web developer, this should feel rather familiar. You’ll use JSX throughout this article.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Save your changes to <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">index.ios.js</span> and return to the simulator. Press <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Cmd+R</span>, and you’ll see your application refresh to display the updated message.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<img alt="hello world again" class="aligncenter bordered size-large wp-image-127101" height="500" sizes="(max-width: 281px) 100vw, 281px" src="https://koenig-media.raywenderlich.com/uploads/2016/02/hello-world-again-281x500.png" srcset="https://koenig-media.raywenderlich.com/uploads/2016/02/hello-world-again-281x500.png 281w, https://koenig-media.raywenderlich.com/uploads/2016/02/hello-world-again-180x320.png 180w, https://koenig-media.raywenderlich.com/uploads/2016/02/hello-world-again.png 750w" style="border: 1px solid rgb(0, 0, 0); clear: both; display: block; height: auto; margin-bottom: 1.625em; margin-left: auto; margin-right: auto; max-width: 100%; vertical-align: top;" width="281" /></div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Re-running a React Native application is really as simple as refreshing a web browser! :] Note that this will only reflect changes made to your JavaScript files – native code or resource changes will require a rebuild in Xcode.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Since you’ll be working with the same set of JavaScript in this tutorial, you can leave the app running and simply refresh the app in this fashion after modifying and saving <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">index.ios.js</span>.</div>
<div class="note" style="background-color: #edf0d5; border-radius: 4px; border: 1px solid rgb(0, 0, 0); font-family: Helvetica, sans-serif; font-size: 16px; line-height: 25.88px; margin: 5px 0px 17px; outline: 0px; padding: 14px !important; vertical-align: baseline;">
<div style="border: 0px; font-family: inherit; font-size: 1em; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; vertical-align: baseline;">
<span style="border: 0px; color: #006837; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Note:</span> If you are feeling inquisitive, take a look at your ‘bundle’ in the browser to see what the JSX is transformed into.</div>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Okay, enough of this “Hello World” fun; it’s time to build the real application!</div>
<h2 style="background-color: white; border: 0px; color: #006837; font-family: Bitter, Georgia, serif; font-size: 26px; margin: -3px 0px 0px; outline: 0px; padding: 5px 0px 20px; vertical-align: baseline;">
Adding Navigation</h2>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
The Property Finder app uses the standard stack-based navigation experience provided by UIKit’s navigation controller. It’s time to add this behavior.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Within <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">index.ios.js</span>, rename the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">PropertyFinderApp</code> class to <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">HelloWorld</code>:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606312" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code12" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">class</span> HelloWorld <span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">extends</span> React.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Component</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
You’ll keep the “Hello World” text display around a little longer, but it won’t be the root component of your app anymore.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Next add the following class below the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">HelloWorld</code> component:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606313" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code13" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">class</span> PropertyFinderApp <span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">extends</span> React.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Component</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
render<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">return</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>ReactNative.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">NavigatorIOS</span>
style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">container</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
initialRoute<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
title<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'Property Finder'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
component<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> HelloWorld<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">/></span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This constructs a navigation controller, applies a style and sets the initial route to the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">HelloWorld</code> component. In web development, <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">routing</span> is a technique for defining the navigation structure of an application, where pages — or <i>routes</i> — are mapped to URLs.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Within the same file, update the styles declaration to include the container style as shown below:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606314" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code14" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> styles <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> ReactNative.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">StyleSheet</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">create</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
text<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
color<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'black'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
backgroundColor<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'white'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
fontSize<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">30</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
margin<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">80</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
container<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
flex<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">1</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
You’ll find out what <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">flex: 1</code> means a bit later in this tutorial.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Save your changes, head back to the simulator and press <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Cmd+R</span> to see your new UI in action:</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<a href="https://koenig-media.raywenderlich.com/uploads/2015/03/react-helloworldagain.png" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><img alt="React Native tutorial" class="aligncenter bordered size-large wp-image-99640" height="500" sizes="(max-width: 281px) 100vw, 281px" src="https://koenig-media.raywenderlich.com/uploads/2015/03/react-helloworldagain-281x500.png" srcset="https://koenig-media.raywenderlich.com/uploads/2015/03/react-helloworldagain-281x500.png 281w, https://koenig-media.raywenderlich.com/uploads/2015/03/react-helloworldagain-180x320.png 180w, https://koenig-media.raywenderlich.com/uploads/2015/03/react-helloworldagain.png 750w" style="border: 1px solid rgb(0, 0, 0); clear: both; display: block; height: auto; margin-bottom: 1.625em; margin-left: auto; margin-right: auto; max-width: 100%; vertical-align: top;" width="281" /></a></div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
There’s the navigation controller with its root view, which is currently the “Hello World” text. Excellent — you now have the basic navigation structure for your application in place. It’s time to add the ‘real’ UI!</div>
<h2 style="background-color: white; border: 0px; color: #006837; font-family: Bitter, Georgia, serif; font-size: 26px; margin: -3px 0px 0px; outline: 0px; padding: 5px 0px 20px; vertical-align: baseline;">
Building the Search Page</h2>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Add a new file to the project named <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchPage.js</span> and place it in the same folder as <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">index.ios.js</span>. Add the following code to this file:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606315" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code15" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'use strict'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">import</span> React<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span> Component <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span> from <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'react'</span>
<span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">import</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
StyleSheet<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
Text<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
TextInput<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
View<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
TouchableHighlight<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
ActivityIndicator<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
Image
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span> from <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'react-native'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
You’ve already seen the strict mode and the react/react-native import before, but the assignment statement that follows it is something new.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This is a <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">destructuring assignment</span>, which lets you extract multiple object properties and assign them to variables using a single statement. As a result, the rest of your code can drop the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">React</code> prefix; for example, you can refer directly to <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">StyleSheet</code> rather than <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">ReactNative.StyleSheet</code>. Destructuring is also useful for manipulating arrays and is <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">well worth learning more about</a>.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Still working in <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchPage.js</span>, add the following style at the bottom:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606316" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code16" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> styles <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> StyleSheet.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">create</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
description<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
marginBottom<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">20</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
fontSize<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">18</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
textAlign<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'center'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
color<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'#656565'</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
container<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
padding<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">30</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
marginTop<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">65</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
alignItems<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'center'</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Again, these are standard CSS properties. Setting up styles like this is less visual than using Interface Builder, but it’s better than setting view properties one by one in your <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">viewDidLoad()</code> methods! :]</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Add the component itself just below the styles you added above:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606317" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code17" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">class</span> SearchPage <span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">extends</span> Component <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
render<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">return</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>View style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">container</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>Text style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">description</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
Search <span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">for</span> houses to buy<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">!</span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>Text<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>Text style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">description</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
Search by place<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">-</span><span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">name</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span> postcode or search near your location.
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>Text<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>View<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">render</code> is a great demonstration of JSX and the structure it provides. Along with the style, you can very easily visualize the UI constructed by this component: a container with two text labels.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Finally, add the following to the end of the file:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606318" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code18" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">module.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">exports</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> SearchPage<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This exports the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchPage</code> class, which permits its use in other files.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
The next step is to update the application routing in order to make this the initial route.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Open <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">index.ios.js</span> and add the following just after the current <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">require</code> imports near the top of the file:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606319" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code19" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> SearchPage <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> require<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'./SearchPage'</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Within the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">render</code> function of the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">PropertyFinderApp</code> class, update <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">initialRoute</code> to reference the newly added page as shown below:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606320" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code20" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">component<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> SearchPage</pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
At this point you can remove the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">HelloWorld</code> class and its associated style, if you like. You won’t be needing that code any longer.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Save your changes, return to the simulator, and hit Cmd+R and check out the new UI:</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<a href="https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchstarter.png" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><img alt="React Native tutorial" class="aligncenter bordered size-large wp-image-99641" height="500" sizes="(max-width: 281px) 100vw, 281px" src="https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchstarter-281x500.png" srcset="https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchstarter-281x500.png 281w, https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchstarter-180x320.png 180w, https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchstarter.png 750w" style="border: 1px solid rgb(0, 0, 0); clear: both; display: block; height: auto; margin-bottom: 1.625em; margin-left: auto; margin-right: auto; max-width: 100%; vertical-align: top;" width="281" /></a></div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This is using the new component, <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchPage</span>, which you added.</div>
<h2 style="background-color: white; border: 0px; color: #006837; font-family: Bitter, Georgia, serif; font-size: 26px; margin: -3px 0px 0px; outline: 0px; padding: 5px 0px 20px; vertical-align: baseline;">
Styling with Flexbox</h2>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
So far, you’ve seen basic CSS properties that deal with margins, paddings and color. However, you might not be familiar with <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">flexbox</span>, a more recent addition to the CSS specification that is very useful for application UI layout.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
React Native uses the <a href="https://github.com/facebook/css-layout" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">css-layout</a> library, a JavaScript implementation of the flexbox standard which is transpiled into C (for iOS) and Java (for Android).</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
It’s great that Facebook has created this as a separate project that targets multiple languages, since this allows for novel applications, such as applying <a href="http://blog.scottlogic.com/2015/02/02/svg-layout-flexbox.html" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">flexbox layout to SVG</a>.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
In your app, the container has the default flow direction of <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">column</code>, which means its children are arranged in a vertical stack, like so:</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<a href="https://koenig-media.raywenderlich.com/uploads/2015/03/FlexStack.png" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><img alt="React Native tutorial" class="aligncenter bordered size-full wp-image-99489" height="471" sizes="(max-width: 634px) 100vw, 634px" src="https://koenig-media.raywenderlich.com/uploads/2015/03/FlexStack.png" srcset="https://koenig-media.raywenderlich.com/uploads/2015/03/FlexStack.png 634w, https://koenig-media.raywenderlich.com/uploads/2015/03/FlexStack-431x320.png 431w" style="border: 1px solid rgb(0, 0, 0); clear: both; display: block; height: auto; margin-bottom: 1.625em; margin-left: auto; margin-right: auto; max-width: 100%; vertical-align: top;" width="634" /></a></div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This is termed the <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">main axis</span>, and can run either vertically or horizontally.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
The vertical position of each child is determined from a combination of its margin, height and padding. The container also sets the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">alignItems</code> property to <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">center</code>, which determines the placement of children on the <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">cross axis</span>. In this case, it results in center-aligned text.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
It’s time to add the input field and buttons. Open <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchPage.js</span> and insert the following just after the closing tag of the second <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Text</code> element:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606321" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code21" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>View style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">flowRight</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>TextInput
style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">searchInput</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
placeholder<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'Search via name or postcode'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">/></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>TouchableHighlight style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">button</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
underlayColor<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'#99d9f4'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>Text style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">buttonText</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>Go<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>Text<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>TouchableHighlight<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>View<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>TouchableHighlight style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">button</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
underlayColor<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'#99d9f4'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>Text style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">buttonText</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>Location<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>Text<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>TouchableHighlight<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
You’ve added two top-level views here: one to hold a text input and a button, and one with only a button. You’ll read about how these elements are styled in a little bit.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
In your styles definition, add a comma following the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">container</code> style, then add the following new styles below it:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606322" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code22" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">flowRight<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
flexDirection<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'row'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
alignItems<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'center'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
alignSelf<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'stretch'</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
buttonText<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
fontSize<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">18</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
color<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'white'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
alignSelf<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'center'</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
button<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
height<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">36</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
flex<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">1</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
flexDirection<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'row'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
backgroundColor<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'#48BBEC'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
borderColor<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'#48BBEC'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
borderWidth<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">1</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
borderRadius<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">8</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
marginBottom<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">10</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
alignSelf<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'stretch'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
justifyContent<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'center'</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
searchInput<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
height<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">36</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
padding<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">4</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
marginRight<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">5</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
flex<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">4</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
fontSize<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">18</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
borderWidth<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">1</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
borderColor<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'#48BBEC'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
borderRadius<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">8</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
color<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'#48BBEC'</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Take care with the formatting; each style property should be separated by a comma. That means you’ll need to add a trailing comma after the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">container</code> selector.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
These styles are used by the text input and buttons which you just added.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Save your changes, return to the simulator, and press <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Cmd+R</span> to see the updated UI:</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<a href="https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchpageinput.png" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><img alt="React Native tutorial" class="aligncenter bordered size-large wp-image-99721" height="500" sizes="(max-width: 281px) 100vw, 281px" src="https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchpageinput-281x500.png" srcset="https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchpageinput-281x500.png 281w, https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchpageinput-180x320.png 180w, https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchpageinput.png 750w" style="border: 1px solid rgb(0, 0, 0); clear: both; display: block; height: auto; margin-bottom: 1.625em; margin-left: auto; margin-right: auto; max-width: 100%; vertical-align: top;" width="281" /></a></div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
The text field and ‘Go’ button are on the same row, so you’ve wrapped them in a container view using the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">flowRight</code> style which uses <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">flexDirection: 'row'</code> to horizontally place the items in a row. Rather than explicitly specifying the widths of the input field and button, you give each a <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">flex</code> value to define their relative width. The text field uses the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">searchInput</code> style with <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">flex: 4</code>, while the button uses the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">button</code> style with <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">flex: 1</code>; this results in their widths having a 4:1 ratio.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
You might have noticed that your buttons…aren’t actually buttons! :] With UIKit, buttons are little more than labels that can be tapped, and as a result the React Native team decided it was easier to construct buttons directly in JavaScript. The buttons in your app use <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">TouchableHighlight</code>, a React Native component that becomes transparent and reveals the underlay color when tapped.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
The final step to complete the search screen of the application is to add the house graphic. The images are <a href="https://koenig-media.raywenderlich.com/uploads/2015/03/ReactNative-HouseImage.zip" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">available to download as a zip file</a>. Download and unzip the file.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Next, create a directory in your root project folder and call it <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">’Resources’</span>. Place the three images of the house in this directory.</div>
<div class="note" style="background-color: #edf0d5; border-radius: 4px; border: 1px solid rgb(0, 0, 0); font-family: Helvetica, sans-serif; font-size: 16px; line-height: 25.88px; margin: 5px 0px 17px; outline: 0px; padding: 14px !important; vertical-align: baseline;">
<div style="border: 0px; font-family: inherit; font-size: 1em; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; vertical-align: baseline;">
<span style="border: 0px; color: #006837; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Asset Catalogs:</span> As you probably know, Apple recommends placing images in Asset Catalogs where possible. In React Native, however, it’s <a href="http://facebook.github.io/react-native/docs/images.html#content" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">recommended not to</a>. Placing your assets alongside your components helps to keep your components self contained, doesn’t require the App to be relaunched if you add new images and provides a single place for adding images if you are building on both iOS and Android.</div>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Back in <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchPage.js</span>, add the following beneath the closing tag of the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">TouchableHighlight</code> component defining the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">location</code> button:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606323" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code23" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>Image source<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>require<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'./Resources/house.png'</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span> style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">image</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">/></span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Now, add the image’s corresponding style to the end of the style list, remembering to add a trailing comma to the previous style:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606324" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code24" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">image<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
width<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">217</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
height<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">138</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Save your changes. Returning to the simulator, hit Cmd+R and admire your new UI:</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<a href="https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchpagehouse.png" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><img alt="React Native tutorial" class="aligncenter bordered size-large wp-image-99720" height="500" sizes="(max-width: 281px) 100vw, 281px" src="https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchpagehouse-281x500.png" srcset="https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchpagehouse-281x500.png 281w, https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchpagehouse-180x320.png 180w, https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchpagehouse.png 750w" style="border: 1px solid rgb(0, 0, 0); clear: both; display: block; height: auto; margin-bottom: 1.625em; margin-left: auto; margin-right: auto; max-width: 100%; vertical-align: top;" width="281" /></a></div>
<div class="note" style="background-color: #edf0d5; border-radius: 4px; border: 1px solid rgb(0, 0, 0); font-family: Helvetica, sans-serif; font-size: 16px; line-height: 25.88px; margin: 5px 0px 17px; outline: 0px; padding: 14px !important; vertical-align: baseline;">
<span style="border: 0px; color: #006837; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Note:</span> If you don’t see the house image at this point and see an image that “house” cannot be found instead, try restarting the packager (i.e. the “npm start” command you have in the terminal).</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Your current app looks good, but it’s somewhat lacking in functionality. Your task now is to add some state to your app and perform some actions.</div>
<h2 style="background-color: white; border: 0px; color: #006837; font-family: Bitter, Georgia, serif; font-size: 26px; margin: -3px 0px 0px; outline: 0px; padding: 5px 0px 20px; vertical-align: baseline;">
Adding Component State</h2>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Each React component has its own state object, which is used as a key-value store. Before a component is rendered you must set the initial state.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Within <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchPage.js</span>, add the following code to the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchPage</code> class, just before <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">render()</code>:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606325" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code25" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">constructor<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>props<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
<span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">super</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>props<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">state</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
searchString<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'london'</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Your component now has a <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">state</code> variable, with <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">searchString</code> set to an initial value of <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">london</code>.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Time to make use of this component state. Within <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">render</code>, change the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">TextInput</code> element to the following:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606326" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code26" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>TextInput
style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">searchInput</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
value<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span><span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">state</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">searchString</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
placeholder<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'Search via name or postcode'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">/></span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This sets the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">TextInput</code> value property — that is, the text displayed to the user — to the current value of the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">searchString</code> state variable. This takes care of setting the initial state, but what happens when the user edits this text?</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
The first step is to create a method that acts as an event handler. Within the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchPage</code> class add the following method below the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">constructor</code>:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606327" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code27" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">onSearchTextChanged<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>event<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
console.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">log</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'onSearchTextChanged'</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">setState</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span> searchString<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> event.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">nativeEvent</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">text</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
console.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">log</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">state</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">searchString</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This takes the value from the native browser event’s <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">text</code> property and uses it to update the component’s state. It also adds some logging code that will make sense shortly.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
To wire up this method so it gets called when the text changes, return to the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">TextInput</code> field within the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">render</code>method and add an <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">onChange</code> property so the tag looks like the following:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606328" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code28" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>TextInput
style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">searchInput</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
value<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span><span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">state</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">searchString</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
onChange<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span><span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">onSearchTextChanged</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">bind</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
placeholder<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'Search via name or postcode'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">/></span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Whenever the user changes the text, you invoke the function supplied to <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">onChange</code>; in this case, it’s <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">onSearchTextChanged</code>.</div>
<div class="note" style="background-color: #edf0d5; border-radius: 4px; border: 1px solid rgb(0, 0, 0); font-family: Helvetica, sans-serif; font-size: 16px; line-height: 25.88px; margin: 5px 0px 17px; outline: 0px; padding: 14px !important; vertical-align: baseline;">
<div style="border: 0px; font-family: inherit; font-size: 1em; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; vertical-align: baseline;">
<span style="border: 0px; color: #006837; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Note:</span> You might be wondering what the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">bind(this)</code> statement is for. JavaScript treats the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</code> keyword a little differently than most other languages; its counterpart in Swift is <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">self</code>. The use of <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">bind</code> in this context ensures that inside the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">onSearchTextChanged</code> method, <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</code> is a reference to the component instance. For more information, see the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">MDN page on <code style="border: 0px; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</code></a>.</div>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
There’s one final step before you refresh your app again: add the following logging statement to the top of <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">render()</code>, just before <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">return</code>:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606329" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code29" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">console.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">log</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'SearchPage.render'</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
You are about to learn something quite intriguing from these log statements! :]</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Save your changes, return to your simulator, then press <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Cmd+R</span>. You should now see that the text input has an initial value of ‘london’ and that editing the text causes some statements to be logged to the Xcode console:</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<img alt="React Native tutorial" class="aligncenter size-full wp-image-99734" height="73" src="https://koenig-media.raywenderlich.com/uploads/2015/03/react-renderconsole.png" style="clear: both; display: block; height: auto; margin-bottom: 1.625em; margin-left: auto; margin-right: auto; max-width: 100%; vertical-align: top;" width="235" /></div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Looking at the screenshot above, the order of the logging statement seems a little odd:</div>
<ol style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 11px 30px; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px 0px 10px; outline: 0px; padding: 0px; vertical-align: baseline;">This is the initial call to <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">render()</code> to set up the view.</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px 0px 10px; outline: 0px; padding: 0px; vertical-align: baseline;">You invoke <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">onSearchTextChanged()</code> when the text changes.</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px 0px 10px; outline: 0px; padding: 0px; vertical-align: baseline;">You then update the component state to reflect the new input text, which triggers another render.</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px 0px 10px; outline: 0px; padding: 0px; vertical-align: baseline;"><code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">onSearchTextChanged()</code> then wraps things up by logging the new search string.</li>
</ol>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Whenever the app updates the state of any React component, this triggers an entire UI re-rendering that in turn calls the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">render</code> of all of your components. This is a great idea, as it entirely de-couples the rendering logic from the state changes that affect the UI.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
With most other UI frameworks, it is either your responsibility to manually update the UI based on state changes, or it’s done via some type of binding framework which creates an implicit link between the application state and its UI representation. For an example of the later, see this article on implementing the <a href="http://www.raywenderlich.com/74106/mvvm-tutorial-with-reactivecocoa-part-1" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">MVVM pattern with ReactiveCocoa</a>.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
With React, you no longer have to worry about which parts of the UI might be affected by a state change; your entire UI is simply expressed as a function of your application state.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
At this point you’ve probably spotted a fundamental flaw in this concept. Yes, that’s right — performance!</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Surely you can’t just throw away your entire UI and re-build it every time something changes? This is where React gets really smart. Each time the UI renders itself, it takes the view tree returned by your render methods, and reconciles — or diffs — it with the current UIKit view. The output of this reconciliation process is a simple list of updates that React needs to apply to the current view. That means only the things that have actually changed will re-render.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
It’s amazing to see the novel concepts that make ReactJS so unique — the virtual-DOM (Document Object Model, the visual-tree of a web document) and reconciliation — applied to an iOS app.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
You can wrap your head around all that later; you still have some work to do in the app. First, remove the logging code you just added above, since it’s no longer necessary and just adds cruft to the code.</div>
<h2 style="background-color: white; border: 0px; color: #006837; font-family: Bitter, Georgia, serif; font-size: 26px; margin: -3px 0px 0px; outline: 0px; padding: 5px 0px 20px; vertical-align: baseline;">
Initiating a Search</h2>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
In order to implement the search functionality you need handle the ‘Go’ button press, create a suitable API request, and provide a visual indication to the user that a query is in progress.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Within <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchPage.js</span>, update the initial state within the constructor:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606330" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code30" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">state</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
searchString<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'london'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
isLoading<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">false</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
The new <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">isLoading</code> property will keep track of whether a query is in progress.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Add the following logic to the start of <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">render</code>:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606331" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code31" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> spinner <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> <span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">state</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">isLoading</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">?</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>ActivityIndicator
size<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'large'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">/></span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>View<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">/></span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This is a ternary <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">if</code> statement that either adds an activity indicator or an empty view, depending on the component’s <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">isLoading</code> state. Because the entire component is rendered each time, you are free to mix JSX and JavaScript logic.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Within the JSX that defines the search UI in <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">return</code>, add the following line below the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Image</code> to place the spinner:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606332" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code32" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>spinner<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Next, add the following methods to the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchPage</code> class:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606333" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code33" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">_executeQuery<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>query<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
console.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">log</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>query<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">setState</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span> isLoading<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">true</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
onSearchPressed<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
<span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> query <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> urlForQueryAndPage<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'place_name'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span> <span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">state</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">searchString</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">1</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>._executeQuery<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>query<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">_executeQuery()</code> will eventually run the query, but for now it simply logs a message to the console and sets <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">isLoading</code> appropriately so the UI can show the new state.</div>
<div class="note" style="background-color: #edf0d5; border-radius: 4px; border: 1px solid rgb(0, 0, 0); font-family: Helvetica, sans-serif; font-size: 16px; line-height: 25.88px; margin: 5px 0px 17px; outline: 0px; padding: 14px !important; vertical-align: baseline;">
<div style="border: 0px; font-family: inherit; font-size: 1em; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; vertical-align: baseline;">
<span style="border: 0px; color: #006837; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Note:</span> JavaScript classes do not have access modifiers, so they have no concept of ‘private’. As a result you often see developers prefixing methods with an underscore to indicate that they should be considered private.</div>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">onSearchPressed()</code> configures and initiates the search query. This should kick off when the ‘Go’ button is pressed. To accomplish that, go back to the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">render</code> method and add the following property within the opening <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">TouchableHighlight</code> tag that renders the ‘Go’ text:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606334" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code34" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">onPress<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span><span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">onSearchPressed</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">bind</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Finally, add the following utility function just above the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchPage</code> class declaration:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606335" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code35" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">function</span> urlForQueryAndPage<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>key<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span> value<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span> pageNumber<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
<span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> data <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
country<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'uk'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
pretty<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'1'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
encoding<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'json'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
listing_type<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'buy'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
action<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'search_listings'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
page<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> pageNumber
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
data<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">[</span>key<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">]</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> value<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> querystring <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> Object.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">keys</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>data<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span>
.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">map</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>key <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=></span> key <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">+</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'='</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">+</span> encodeURIComponent<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>data<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">[</span>key<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">]</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span>
.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">join</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'&'</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">return</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'http://api.nestoria.co.uk/api?'</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">+</span> querystring<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This function doesn’t depend on <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchPage</code>, so it’s implemented as a free function rather than a method. It first creates the query string based on the parameters in <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">data</code>. Following this, it transforms the data into the required string format, <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">name=value</code> pairs separated by ampersands. The <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=></code> syntax is an arrow function, another <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">recent addition to the JavaScript language</a> that provides a succinct syntax for creating anonymous functions.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Save your changes, head back to the simulator, and press <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Cmd+R</span> to reload the application and tap the ‘Go’ button. You’ll see the activity indicator spin; take a look at the Xcode console to see what it’s telling you:</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<a href="https://koenig-media.raywenderlich.com/uploads/2015/03/SearchAcitivityIndicator.png" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><img alt="React Native tutorial" class="alignnone size-large wp-image-99493" height="169" sizes="(max-width: 700px) 100vw, 700px" src="https://koenig-media.raywenderlich.com/uploads/2015/03/SearchAcitivityIndicator-700x169.png" srcset="https://koenig-media.raywenderlich.com/uploads/2015/03/SearchAcitivityIndicator-700x169.png 700w, https://koenig-media.raywenderlich.com/uploads/2015/03/SearchAcitivityIndicator-480x116.png 480w, https://koenig-media.raywenderlich.com/uploads/2015/03/SearchAcitivityIndicator.png 865w" style="border: 0px; height: auto; max-width: 100%; vertical-align: top;" width="700" /></a></div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
The activity indicator renders and the URL for the required query appears in the log. Copy and paste that URL into your browser to see the result. You’ll see a massive JSON object. Don’t worry — you don’t need to understand that! You’ll add code to parse that now.</div>
<div class="note" style="background-color: #edf0d5; border-radius: 4px; border: 1px solid rgb(0, 0, 0); font-family: Helvetica, sans-serif; font-size: 16px; line-height: 25.88px; margin: 5px 0px 17px; outline: 0px; padding: 14px !important; vertical-align: baseline;">
<span style="border: 0px; color: #006837; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Note:</span> This app makes use of the <a href="http://www.nestoria.co.uk/help/api" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Nestoria API for searching property listings</a>. The JSON response coming back from the API is pretty straightforward, but you can have a look at the documentation for all the details on the expected request URL and response formats.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
The next step is to make the request from within your application.</div>
<h2 style="background-color: white; border: 0px; color: #006837; font-family: Bitter, Georgia, serif; font-size: 26px; margin: -3px 0px 0px; outline: 0px; padding: 5px 0px 20px; vertical-align: baseline;">
Performing an API Request</h2>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Still within <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchPage.js</span>, update the initial state in the class constructor to add a <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">message</code> variable:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606336" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code36" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">state</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
searchString<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'london'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
isLoading<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">false</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
message<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">''</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Within <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">render</code>, add the following to the bottom of your UI:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606337" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code37" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>Text style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">description</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span><span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">state</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">message</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>Text<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
You’ll use this to display a range of messages to the user.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Within the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchPage</code> class, add the following code to the end of <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">_executeQuery()</code>:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606338" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code38" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">fetch<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>query<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span>
.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">then</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>response <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=></span> response.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">json</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span>
.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">then</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>json <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=></span> <span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>._handleResponse<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>json.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">response</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span>
.<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">catch</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>error <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=></span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">setState</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
isLoading<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">false</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
message<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'Something bad happened '</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">+</span> error
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This makes use of the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">fetch</code> function, which is <a href="https://fetch.spec.whatwg.org/" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">part of the Web API</a>, and provides a vastly improved API versus XMLHttpRequest. The asynchronous response is returned as a <a href="http://www.html5rocks.com/en/tutorials/es6/promises/" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">promise</a>, with the success path parsing the JSON and supplying it to <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">_handleResponse</code> which you are going to add next.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
The final step is to add the following function to <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchPage</code>:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606339" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code39" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">_handleResponse<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>response<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">setState</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span> isLoading<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">false</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span> message<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">''</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">if</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>response.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">application_response_code</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">substr</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">0</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">1</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">===</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'1'</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
console.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">log</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'Properties found: '</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">+</span> response.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">listings</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">length</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span> <span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">else</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">setState</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span> message<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'Location not recognized; please try again.'</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This clears <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">isLoading</code> and logs the number of properties found if the query was successful.</div>
<div class="note" style="background-color: #edf0d5; border-radius: 4px; border: 1px solid rgb(0, 0, 0); font-family: Helvetica, sans-serif; font-size: 16px; line-height: 25.88px; margin: 5px 0px 17px; outline: 0px; padding: 14px !important; vertical-align: baseline;">
<div style="border: 0px; font-family: inherit; font-size: 1em; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; vertical-align: baseline;">
<span style="border: 0px; color: #006837; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Note:</span> Nestoria has <a href="http://www.nestoria.co.uk/help/api-return-codes" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">a number of non-1** response codes</a> that are potentially useful. For example, 202 and 200 return a list of best-guess locations. When you’ve finished building your app, why not try handling these and present a list of options to the user?</div>
</div>
<div class="note" style="background-color: #edf0d5; border-radius: 4px; border: 1px solid rgb(0, 0, 0); font-family: Helvetica, sans-serif; font-size: 16px; line-height: 25.88px; margin: 5px 0px 17px; outline: 0px; padding: 14px !important; vertical-align: baseline;">
<div style="border: 0px; font-family: inherit; font-size: 1em; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<span style="border: 0px; color: #006837; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Note:</span> The Nestoria API isn’t available over HTTPS. You’ll need to add the following App Transport Security exception to your <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Info.plist</code>, in the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">NSExceptionDomains</code> dictionary under the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">NSAppTransportSecurity</code>section:</div>
<pre style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; vertical-align: baseline;"><key>api.nestoria.co.uk</key>
<dict>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
<key>imgs.nestimg.com</key>
<dict>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</pre>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Save your work, rebuild your Xcode project (to make sure your <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Plist</code> changes are used) and try searching for ‘london’; you should see a log message saying that 20 properties (the default result size) were found.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
It’s time to see what those 20 properties in real places such as London look like!</div>
<h2 style="background-color: white; border: 0px; color: #006837; font-family: Bitter, Georgia, serif; font-size: 26px; margin: -3px 0px 0px; outline: 0px; padding: 5px 0px 20px; vertical-align: baseline;">
Displaying the Results</h2>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Create a new file <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchResults.js</span>, and add the following:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606340" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code40" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'use strict'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">import</span> React<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span> Component <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span> from <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'react'</span>
<span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">import</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
StyleSheet<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
Image<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
View<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
TouchableHighlight<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
ListView<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
Text
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span> from <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'react-native'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Yes, that’s right, it’s two <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">require</code> statements that includes the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">react</code> & <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">react-native</code> modules, using destructuring assignments. You’ve been paying attention haven’t you? :]</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Next add the component itself:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606341" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code41" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">class</span> SearchResults <span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">extends</span> Component <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
constructor<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>props<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
<span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">super</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>props<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> dataSource <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> <span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">new</span> ListView.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">DataSource</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>rowHasChanged<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>r1<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span> r2<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=></span> r1.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">lister_url</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">!==</span> r2.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">lister_url</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">state</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
dataSource<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> dataSource.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">cloneWithRows</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">props</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">listings</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
renderRow<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>rowData<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span> sectionID<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span> rowID<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">return</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>TouchableHighlight
underlayColor<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'#dddddd'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>View<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>Text<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>rowData.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">title</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>Text<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>View<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>TouchableHighlight<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
render<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">return</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>ListView
dataSource<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span><span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">state</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">dataSource</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
renderRow<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span><span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">renderRow</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">bind</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">/></span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
The above code makes use of a more specialized component — <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">ListView</code> — which displays rows of data within a scrolling container, similar to <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">UITableView</code>. You supply data to the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">ListView</code> via a <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">ListView.DataSource</code>, and a function that supplies the UI for each row.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
When constructing the data source, you provide a function that compares the identity of a pair of rows. The <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">ListView</code> uses this during the reconciliation process, in order to determine the changes in the list data. In this instance, the properties returned by the Nestoria API have a <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">lister_url</code> property, which is a suitable check for this purpose.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Now add the module export to the end of the file:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606342" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code42" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">module.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">exports</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> SearchResults<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Add the following to <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchPage.js</span> near the top of the file, underneath the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">import</code> call for React Native:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606343" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code43" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> SearchResults <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> require<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'./SearchResults'</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This allows us to use the newly added <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchResults</code> class from within the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchPage</code> class.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Modify the current <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">_handleResponse</code> method by replacing the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">console.log</code> statement with the following:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606344" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code44" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">props</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">navigator</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">push</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
title<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'Results'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
component<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> SearchResults<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
passProps<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>listings<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> response.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">listings</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
The above code navigates to your newly added <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchResults</code> component and passes in the listings from the API request. Using the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">push</code> method ensures the search results are pushed onto the navigation stack, which means you’ll get a ‘Back’ button to return to the root.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Save your changes, head back to the simulator, press <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Cmd+R</span> and try a quick search. You’ll be greeted by a list of properties:</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<a href="https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchresults1.png" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><img alt="React Native tutorial" class="aligncenter bordered size-large wp-image-99731" height="500" sizes="(max-width: 281px) 100vw, 281px" src="https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchresults1-281x500.png" srcset="https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchresults1-281x500.png 281w, https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchresults1-180x320.png 180w, https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchresults1.png 750w" style="border: 1px solid rgb(0, 0, 0); clear: both; display: block; height: auto; margin-bottom: 1.625em; margin-left: auto; margin-right: auto; max-width: 100%; vertical-align: top;" width="281" /></a></div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
It’s great to see the property listings, but that list is a little drab. Time to liven things up a bit.</div>
<h2 style="background-color: white; border: 0px; color: #006837; font-family: Bitter, Georgia, serif; font-size: 26px; margin: -3px 0px 0px; outline: 0px; padding: 5px 0px 20px; vertical-align: baseline;">
A Touch of Style</h2>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This React Native code should be starting to look familiar by now, so this tutorial is going to pick up the pace.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Add the following style definition just after the destructuring assignment in <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchResults.js</span>:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606345" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code45" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> styles <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> StyleSheet.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">create</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
thumb<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
width<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">80</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
height<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">80</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
marginRight<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">10</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
textContainer<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
flex<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">1</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
separator<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
height<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">1</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
backgroundColor<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'#dddddd'</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
price<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
fontSize<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">25</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
fontWeight<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'bold'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
color<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'#48BBEC'</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
title<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
fontSize<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">20</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
color<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'#656565'</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
rowContainer<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
flexDirection<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'row'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
padding<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">10</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This defines all the styles that you are going to use to render each row.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Next replace <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">renderRow()</code> with the following:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606346" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code46" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">renderRow<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>rowData<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span> sectionID<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span> rowID<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
<span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> price <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> rowData.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">price_formatted</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">split</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">' '</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">[</span><span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">0</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">]</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">return</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>TouchableHighlight onPress<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=></span> <span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">rowPressed</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>rowData.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">lister_url</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
underlayColor<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'#dddddd'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>View<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>View style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">rowContainer</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>Image style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">thumb</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span> source<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span> uri<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> rowData.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">img_url</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">/></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>View style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">textContainer</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>Text style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">price</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>price<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>Text<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>Text style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">title</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
numberOfLines<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span><span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">1</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>rowData.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">title</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>Text<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>View<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>View<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>View style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">separator</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">/></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>View<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>TouchableHighlight<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This manipulates the returned price, which is in the format ‘300,000 GBP’, to remove the GBP suffix. Then it renders the row UI using techniques that you are by now quite familiar with. Of note, an <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Image</code> is added to the row and is loaded from a returned URL (<code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">rowData.img_url</code>) which React Native decodes off the main thread.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Also, note the use of an arrow function in the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">onPress</code> property of the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">TouchableHighlight</code> component; this is used to capture the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">lister_url</code> for the row.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
The final step is to add this method to the class to handle the press:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606347" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code47" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">rowPressed<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>listerURL<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
<span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> property <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> <span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">props</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">listings</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">filter</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>prop <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=></span> prop.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">lister_url</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">===</span> listerURL<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">[</span><span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">0</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">]</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This method locates the property that was tapped by the user. It doesn’t do anything with it yet, but you’ll fix that shortly. But right now, it’s time to admire your handiwork.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Save your work, head back to the simulator, press <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Cmd+R</span> and check out your results:</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<a href="https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchresults2.png" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><img alt="React Native tutorial" class="aligncenter bordered size-large wp-image-99732" height="500" sizes="(max-width: 281px) 100vw, 281px" src="https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchresults2-281x500.png" srcset="https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchresults2-281x500.png 281w, https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchresults2-180x320.png 180w, https://koenig-media.raywenderlich.com/uploads/2015/03/react-searchresults2.png 750w" style="border: 1px solid rgb(0, 0, 0); clear: both; display: block; height: auto; margin-bottom: 1.625em; margin-left: auto; margin-right: auto; max-width: 100%; vertical-align: top;" width="281" /></a></div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
That looks a lot better — although it’s a wonder anyone can afford to live in London!</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Time to add the final view to the application.</div>
<h2 style="background-color: white; border: 0px; color: #006837; font-family: Bitter, Georgia, serif; font-size: 26px; margin: -3px 0px 0px; outline: 0px; padding: 5px 0px 20px; vertical-align: baseline;">
Property Details View</h2>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Add a new file <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">PropertyView.js</span> to the project, then add the following to the top of the file:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606348" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code48" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'use strict'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">import</span> React<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span> Component <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span> from <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'react'</span>
<span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">import</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
StyleSheet<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
Image<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
View<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
Text
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span> from <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'react-native'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Surely you can do this in your sleep by now! :]</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Next add the following styles:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606349" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code49" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> styles <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> StyleSheet.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">create</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
container<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
marginTop<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">65</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
heading<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
backgroundColor<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'#F8F8F8'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
separator<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
height<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">1</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
backgroundColor<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'#DDDDDD'</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
image<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
width<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">400</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
height<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">300</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
price<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
fontSize<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">25</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
fontWeight<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'bold'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
margin<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">5</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
color<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'#48BBEC'</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
title<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
fontSize<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">20</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
margin<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">5</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
color<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'#656565'</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
description<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
fontSize<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">18</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
margin<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">5</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
color<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'#656565'</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Then add the component itself:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606350" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code50" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">class</span> PropertyView <span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">extends</span> Component <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
render<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
<span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> property <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> <span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">props</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">property</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> stats <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> property.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">bedroom_number</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">+</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">' bed '</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">+</span> property.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">property_type</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">if</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>property.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">bathroom_number</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
stats <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">+=</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">', '</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">+</span> property.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">bathroom_number</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">+</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">' '</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">+</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>property.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">bathroom_number</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">1</span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">?</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'bathrooms'</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'bathroom'</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
<span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> price <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> property.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">price_formatted</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">split</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">' '</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">[</span><span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">0</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">]</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">return</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>View style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">container</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>Image style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">image</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
source<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>uri<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> property.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">img_url</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">/></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>View style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">heading</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>Text style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">price</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>price<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>Text<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>Text style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">title</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>property.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">title</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>Text<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>View style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">separator</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">/></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>View<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>Text style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">description</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>stats<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>Text<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><</span>Text style<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>styles.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">description</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>property.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">summary</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>Text<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></</span>View<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">></span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
The first part of <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">render()</code> performs some manipulation on the data. As is often the case, the data returned by the API is of mixed quality and often has missing fields. This code applies some simple logic to make the data a bit more presentable.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
The rest of <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">render</code> is quite straightforward; it’s simply a function of the immutable state of this component.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Finally add the following export to the end of the file:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606351" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code51" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">module.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">exports</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> PropertyView<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Head back to <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchResults.js</span> and add the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">require</code> statement to the top of the file, just underneath the React <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">import</code> lines:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606352" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code52" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;"><span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> PropertyView <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> require<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'./PropertyView'</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Next update <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">rowPressed()</code> to navigate to your newly added <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">PropertyView</code>:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606353" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code53" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">rowPressed<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>listerURL<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
<span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> property <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> <span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">props</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">listings</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">filter</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>prop <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=></span> prop.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">lister_url</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">===</span> listerURL<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">[</span><span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">0</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">]</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">props</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">navigator</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">push</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
title<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">"Property"</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
component<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> PropertyView<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
passProps<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>property<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> property<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
You know the drill: save your changes, head back to the Simulator, press <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Cmd+R</span>, and go all the way to the property details by running a search and tapping on a row:</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<a href="https://koenig-media.raywenderlich.com/uploads/2015/03/react-property.png" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><img alt="React Native tutorial" class="aligncenter bordered size-large wp-image-99730" height="500" sizes="(max-width: 281px) 100vw, 281px" src="https://koenig-media.raywenderlich.com/uploads/2015/03/react-property-281x500.png" srcset="https://koenig-media.raywenderlich.com/uploads/2015/03/react-property-281x500.png 281w, https://koenig-media.raywenderlich.com/uploads/2015/03/react-property-180x320.png 180w, https://koenig-media.raywenderlich.com/uploads/2015/03/react-property.png 750w" style="border: 1px solid rgb(0, 0, 0); clear: both; display: block; height: auto; margin-bottom: 1.625em; margin-left: auto; margin-right: auto; max-width: 100%; vertical-align: top;" width="281" /></a></div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Affordable living at it’s finest — that’s a fancy looking pad!</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Your app is almost complete; the final step is to allow users to search for nearby properties.</div>
<h2 style="background-color: white; border: 0px; color: #006837; font-family: Bitter, Georgia, serif; font-size: 26px; margin: -3px 0px 0px; outline: 0px; padding: 5px 0px 20px; vertical-align: baseline;">
Geolocation Search</h2>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Within Xcode, open <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Info.plist</span> and edit the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">NSLocationWhenInUseUsageDescription</code> row to the following value:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606354" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code54" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="console" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">PropertyFinder would like to use your location to find nearby properties</pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Here’s how your plist file will look once you’ve added the new value:</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<a href="https://koenig-media.raywenderlich.com/uploads/2015/03/Screen-Shot-2015-03-20-at-21.49.06.png" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><img alt="React Native tutorial" class="alignnone size-medium wp-image-99798" height="162" sizes="(max-width: 480px) 100vw, 480px" src="https://koenig-media.raywenderlich.com/uploads/2015/03/Screen-Shot-2015-03-20-at-21.49.06-480x162.png" srcset="https://koenig-media.raywenderlich.com/uploads/2015/03/Screen-Shot-2015-03-20-at-21.49.06-480x162.png 480w, https://koenig-media.raywenderlich.com/uploads/2015/03/Screen-Shot-2015-03-20-at-21.49.06-700x237.png 700w" style="border: 0px; height: auto; max-width: 100%; vertical-align: top;" width="480" /></a></div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
This key details the prompt that you’ll present to the to the user to request access to their current location.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Open <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchPage.js</span>, locate the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">TouchableHighlight</code> that renders the ‘Location’ button and add the following property value:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606355" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code55" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">onPress<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span><span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">onLocationPressed</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">bind</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
When you tap the button, you ‘ll invoke <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">onLocationPressed</code> — you’re going to add that next.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Add the following within the body of the <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">SearchPage</code> class:</div>
<div class="wp_codebox" style="background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0.5em; outline: 0px; overflow: auto; padding: 0px; vertical-align: baseline; width: 782.031px;">
<table style="border-collapse: collapse; border-spacing: 0px; border: none; font-family: inherit; font-size: 16px; font-style: inherit; font-weight: inherit; margin: 0px !important; outline: 0px; padding: 0px; vertical-align: baseline; width: 782px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<tr id="p12606356" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><td class="code" id="p126063code56" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 2px 4px; vertical-align: top;"><pre class="javascript" style="background: 0px 0px; border: none; clear: none; float: none; font-size: 12px; font-style: inherit; font-weight: inherit; line-height: 1.333; outline: 0px; overflow: visible; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: auto; word-wrap: break-word;">onLocationPressed<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
navigator.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">geolocation</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">getCurrentPosition</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>
location <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=></span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
<span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> search <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> location.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">coords</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">latitude</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">+</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">','</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">+</span> location.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">coords</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">longitude</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">setState</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span> searchString<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> search <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #003366; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">var</span> query <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=</span> urlForQueryAndPage<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'centre_point'</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span> search<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span> <span style="border: 0px; color: #cc0000; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">1</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>._executeQuery<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span>query<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">,</span>
error <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">=></span> <span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
<span style="border: 0px; color: #000066; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">this</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">setState</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">{</span>
message<span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">:</span> <span style="border: 0px; color: #3366cc; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">'There was a problem with obtaining your location: '</span> <span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">+</span> error
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">;</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">}</span></pre>
</td></tr>
</tbody></table>
</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
The current position is retrieved via <code style="border: 0px; color: #006837; font-family: Courier, monospace !important; font-size: 14px; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">navigator.geolocation</code>; this is an interface <a href="https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/Using_geolocation" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">defined by the Web API</a>, so it should be familiar to anyone who has used location services within the browser. The React Native framework provides its own implementation of this API using the native iOS location services.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
If the current position is successfully obtained, you invoke the first arrow function; this sends a query to Nestoria. If something goes wrong, you’ll display a basic error message instead.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Since you’ve made a change to the plist, you’ll need to relaunch the app to see your changes. No Cmd+R this time — sorry. Stop the app in Xcode, and build and run your project.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Before you use the location-based search, you need to specify a location that is covered by the Nestoria database. From the simulator menu, select <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Debug\Location\Custom Location …</span> and enter a latitude of <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">55.02</span> and a longitude of <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">-1.42</span>, the coordinates of a rather nice seaside town in the North of England that I like to call home!</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Now hit the <span style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Location</span> button, allow location services, and check your results!</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
<a href="https://koenig-media.raywenderlich.com/uploads/2015/03/WhitleyBaySearch.png" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><img alt="React Native tutorial" class="alignnone size-large wp-image-99511" height="500" sizes="(max-width: 647px) 100vw, 647px" src="https://koenig-media.raywenderlich.com/uploads/2015/03/WhitleyBaySearch-647x500.png" srcset="https://koenig-media.raywenderlich.com/uploads/2015/03/WhitleyBaySearch-647x500.png 647w, https://koenig-media.raywenderlich.com/uploads/2015/03/WhitleyBaySearch-414x320.png 414w, https://koenig-media.raywenderlich.com/uploads/2015/03/WhitleyBaySearch.png 700w" style="border: 0px; height: auto; max-width: 100%; vertical-align: top;" width="647" /></a></div>
<div class="note" style="background-color: #edf0d5; border-radius: 4px; border: 1px solid rgb(0, 0, 0); font-family: Helvetica, sans-serif; font-size: 16px; line-height: 25.88px; margin: 5px 0px 17px; outline: 0px; padding: 14px !important; vertical-align: baseline;">
<span style="border: 0px; color: #006837; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Note from Ray:</span> Location searching worked for some of us, but not for others (reporting an access denied error even though we gave access) – we’re not sure why at the moment, perhaps an issue with React Native? If anyone has the same issue and figures it out, please let us know.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
It’s not quite as swank as London — but it’s a lot more affordable! :]</div>
<h2 style="background-color: white; border: 0px; color: #006837; font-family: Bitter, Georgia, serif; font-size: 26px; margin: -3px 0px 0px; outline: 0px; padding: 5px 0px 20px; vertical-align: baseline;">
Where To Go From Here?</h2>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Congratulations on completing your first React Native application! You can <a href="https://koenig-media.raywenderlich.com/uploads/2016/10/PropertyFinder_ReactNative34.zip" sl-processed="1" style="border: 0px; color: #006837; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">find the complete project here</a> if you just want the code to look through or want to compare notes :]</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
If you come from the web world, you can see how easy it is to define your interface and navigation with JavaScript and React to get a fully native UI from your code. If you work mainly on native apps, I hope you’ve gained a feel for the benefits of React Native: fast app iteration, modern JavaScript and clear style rules similar to CSS.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
Perhaps you might write your next app using this framework? Or then again, perhaps you will stick with Swift or Objective-C? Whichever path you take, I hope you have learned something new and interesting in this article, and can carry some of the principles forward into your next project.</div>
<div style="background-color: white; border: 0px; font-family: Helvetica, sans-serif; font-size: 16px; outline: 0px; padding: 0px 0px 10px; vertical-align: baseline;">
If you have any questions or comments on this React Native tutorial, feel free to join the discussion in the forums below!</div>
</div>
Allcad Serviceshttp://www.blogger.com/profile/12867861373206421561noreply@blogger.com0tag:blogger.com,1999:blog-6237687327557176974.post-89287441366956884602017-01-17T02:24:00.000-08:002017-01-17T02:29:59.127-08:00How to brand marketing<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="background-color: #fefefe; box-sizing: border-box; font-family: Arial, Helvetica, sans-serif; line-height: 18px; margin-bottom: 10px; padding: 4px 0px 10px; text-align: left;">
<span style="color: blue;"><br /></span></h2>
<h2 style="background-color: #fefefe; box-sizing: border-box; font-family: Arial, Helvetica, sans-serif; line-height: 18px; margin-bottom: 10px; padding: 4px 0px 10px; text-align: left;">
<span style="color: blue;">Brand Marketing </span></h2>
<div style="background-color: #fefefe; box-sizing: border-box; color: #747474; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; padding: 4px 0px 10px;">
Comparison shopping involves more than just checking prices. Most shoppers also are concerned with the quality of the product and trustworthiness of a company. Does this company offer an exceptional product? Do they stand by their goods? Do their products earn positive reviews? Depending on how important the purchase is, a customer may ask all of these questions and more of each business that offers a product they want.</div>
<div class="lftside" style="background: rgb(222, 240, 188); border-radius: 5px; box-sizing: border-box; color: #747474; float: left; font-family: Arial, Helvetica, sans-serif; font-size: 11px; margin: 10px 30px 16px 10px; padding: 0px; width: 365.188px;">
<h4 style="background-color: #6fc223; border-radius: 5px 5px 0px 0px; box-sizing: border-box; color: white; font-family: inherit; font-size: 16px; font-weight: normal; height: auto; line-height: 1.1; margin: 0px 0px 8px; padding: 10px 10px 6px 18px; width: 365.188px;">
<span class="cufon cufon-canvas" style="box-sizing: border-box; display: inline-block; font-size: 1px; height: 16px; line-height: 1px; margin: 0px; padding: 0px; position: relative; vertical-align: middle; width: 51px;"><canvas height="17" style="box-sizing: border-box; display: inline-block; left: 0px; margin: 0px; padding: 0px; position: relative; top: 0px; vertical-align: baseline;" width="63"></canvas></span><span class="cufon cufon-canvas" style="box-sizing: border-box; display: inline-block; font-size: 1px; height: 16px; line-height: 1px; margin: 0px; padding: 0px; position: relative; vertical-align: middle; width: 81px;"><canvas height="17" style="box-sizing: border-box; display: inline-block; left: 0px; margin: 0px; padding: 0px; position: relative; top: 0px; vertical-align: baseline;" width="94"></canvas></span><span class="cufon cufon-canvas" style="box-sizing: border-box; display: inline-block; font-size: 1px; height: 16px; line-height: 1px; margin: 0px; padding: 0px; position: relative; vertical-align: middle; width: 44px;"><canvas height="17" style="box-sizing: border-box; display: inline-block; left: 0px; margin: 0px; padding: 0px; position: relative; top: 0px; vertical-align: baseline;" width="51"></canvas></span></h4>
<div style="box-sizing: border-box; font-size: 14px; line-height: 18px; margin-bottom: 10px; margin-left: 20px; margin-right: 30px; padding: 4px 0px 10px;">
In this article...</div>
<ul style="box-sizing: border-box; list-style-image: none; list-style-type: none; margin: -10px 10px 14px 14px; padding: 0px;">
<li style="background: none; box-sizing: border-box; color: #666666; font-size: 12px; line-height: 16px; list-style: disc; margin: 0px 0px 4px 30px; padding: 0px 0px 0px 4px;"><a href="http://www.marketing-schools.org/types-of-marketing/brand-marketing.html#link1" style="background-color: transparent; box-sizing: border-box; color: #333333; margin: 0px; outline: none; padding: 0px;">Who employs brand marketing?</a></li>
<li style="background: none; box-sizing: border-box; color: #666666; font-size: 12px; line-height: 16px; list-style: disc; margin: 0px 0px 4px 30px; padding: 0px 0px 0px 4px;"><a href="http://www.marketing-schools.org/types-of-marketing/brand-marketing.html#link2" style="background-color: transparent; box-sizing: border-box; color: #333333; margin: 0px; outline: none; padding: 0px;">For what kinds of customers is brand marketing effective?</a></li>
<li style="background: none; box-sizing: border-box; color: #666666; font-size: 12px; line-height: 16px; list-style: disc; margin: 0px 0px 4px 30px; padding: 0px 0px 0px 4px;"><a href="http://www.marketing-schools.org/types-of-marketing/brand-marketing.html#link3" style="background-color: transparent; box-sizing: border-box; color: #333333; margin: 0px; outline: none; padding: 0px;">How is a brand marketing campaign developed?</a></li>
<li style="background: none; box-sizing: border-box; color: #666666; font-size: 12px; line-height: 16px; list-style: disc; margin: 0px 0px 4px 30px; padding: 0px 0px 0px 4px;"><a href="http://www.marketing-schools.org/types-of-marketing/brand-marketing.html#link4" style="background-color: transparent; box-sizing: border-box; color: #333333; margin: 0px; outline: none; padding: 0px;">What career titles work with brand marketing strategies?</a></li>
<li style="background: none; box-sizing: border-box; color: #666666; font-size: 12px; line-height: 16px; list-style: disc; margin: 0px 0px 4px 30px; padding: 0px 0px 0px 4px;"><a href="http://www.marketing-schools.org/types-of-marketing/brand-marketing.html#link5" style="background-color: transparent; box-sizing: border-box; color: #333333; margin: 0px; outline: none; padding: 0px;">How can a marketing school help you in this field?</a></li>
</ul>
<div style="box-sizing: border-box; font-size: 14px; line-height: 18px; margin-bottom: 10px; margin-left: 20px; margin-right: 30px; padding: 4px 0px 10px;">
Related...</div>
<ul style="box-sizing: border-box; list-style-image: none; list-style-type: none; margin: -10px 10px 14px 14px; padding: 0px;">
<li style="background: none; box-sizing: border-box; color: #666666; font-size: 12px; line-height: 16px; list-style: disc; margin: 0px 0px 4px 30px; padding: 0px 0px 0px 4px;"><a href="http://www.marketing-schools.org/marketing-advertising-schools.html" style="background-color: transparent; box-sizing: border-box; color: #333333; margin: 0px; outline: none; padding: 0px;">Find schools offering marketing programs</a></li>
</ul>
</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #747474; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; padding: 4px 0px 10px;">
Branding is a concept that extends far beyond the marketing of “brand name” designer jeans and other products. A company’s brand represents their market identity—who they are, what they do, what kind of quality they provide, their reputation for trustworthiness, and more. Consequently, brand marketing is important to nearly every business, from those selling breakfast cereals, to those developing new technologies, to those providing logistic support to other businesses.</div>
<div class="rtside" style="background: rgb(222, 240, 188); border-radius: 5px; box-sizing: border-box; color: #747474; float: right; font-family: Arial, Helvetica, sans-serif; font-size: 11px; margin: 10px 10px 10px 30px; padding: 0px; width: 365.188px;">
<h4 style="background-color: #6fc223; border-radius: 5px 5px 0px 0px; box-sizing: border-box; color: white; font-family: inherit; font-size: 16px; font-weight: normal; height: auto; line-height: 1.1; margin: 0px 0px 8px; padding: 10px 10px 6px 18px; width: 365.188px;">
<span class="cufon cufon-canvas" style="box-sizing: border-box; display: inline-block; font-size: 1px; height: 16px; line-height: 1px; margin: 0px; padding: 0px; position: relative; vertical-align: middle; width: 81px;"><canvas height="17" style="box-sizing: border-box; display: inline-block; left: 0px; margin: 0px; padding: 0px; position: relative; top: 0px; vertical-align: baseline;" width="94"></canvas></span><span class="cufon cufon-canvas" style="box-sizing: border-box; display: inline-block; font-size: 1px; height: 16px; line-height: 1px; margin: 0px; padding: 0px; position: relative; vertical-align: middle; width: 19px;"><canvas height="17" style="box-sizing: border-box; display: inline-block; left: 0px; margin: 0px; padding: 0px; position: relative; top: 0px; vertical-align: baseline;" width="32"></canvas></span><span class="cufon cufon-canvas" style="box-sizing: border-box; display: inline-block; font-size: 1px; height: 16px; line-height: 1px; margin: 0px; padding: 0px; position: relative; vertical-align: middle; width: 51px;"><canvas height="17" style="box-sizing: border-box; display: inline-block; left: 0px; margin: 0px; padding: 0px; position: relative; top: 0px; vertical-align: baseline;" width="63"></canvas></span><span class="cufon cufon-canvas" style="box-sizing: border-box; display: inline-block; font-size: 1px; height: 16px; line-height: 1px; margin: 0px; padding: 0px; position: relative; vertical-align: middle; width: 77px;"><canvas height="17" style="box-sizing: border-box; display: inline-block; left: 0px; margin: 0px; padding: 0px; position: relative; top: 0px; vertical-align: baseline;" width="85"></canvas></span></h4>
<ul style="box-sizing: border-box; list-style-image: none; list-style-type: none; margin: 0px 14px 14px 24px; padding: 0px;">
<li style="background: none; box-sizing: border-box; color: #666666; font-size: 12px; line-height: 16px; list-style: disc; margin: 0px 0px 4px 30px; padding: 0px 0px 0px 4px;">Conjure your message instantly</li>
<li style="background: none; box-sizing: border-box; color: #666666; font-size: 12px; line-height: 16px; list-style: disc; margin: 0px 0px 4px 30px; padding: 0px 0px 0px 4px;">Enhance credibility</li>
<li style="background: none; box-sizing: border-box; color: #666666; font-size: 12px; line-height: 16px; list-style: disc; margin: 0px 0px 4px 30px; padding: 0px 0px 0px 4px;">Prompt an emotional affirmation</li>
<li style="background: none; box-sizing: border-box; color: #666666; font-size: 12px; line-height: 16px; list-style: disc; margin: 0px 0px 4px 30px; padding: 0px 0px 0px 4px;">Motivate the buyer</li>
<li style="background: none; box-sizing: border-box; color: #666666; font-size: 12px; line-height: 16px; list-style: disc; margin: 0px 0px 4px 30px; padding: 0px 0px 0px 4px;">Augment customer loyalty</li>
</ul>
</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #747474; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; padding: 4px 0px 10px;">
<br /></div>
<h2 style="background-color: #fefefe; box-sizing: border-box; font-family: Arial, Helvetica, sans-serif; line-height: 18px; margin-bottom: 10px; padding: 4px 0px 10px; text-align: left;">
<span style="color: blue; font-size: small;">Who Employs brand marketing</span></h2>
<div style="background-color: #fefefe; box-sizing: border-box; color: #747474; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; padding: 4px 0px 10px;">
Even when a business is selling a product as a generic, off-brand alternative (such as a marshmallow cereal similar to Lucky Charms, or a laundry detergent similar to Tide), that “generic” product carries that company’s name, and impacts its reputation. If you dislike your Not-Lucky-Charms cereal or your Not-Tide detergent, you’ll think twice before buying another “generic” product from the same company.</div>
<div style="background-color: #fefefe; box-sizing: border-box; color: #747474; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; padding: 4px 0px 10px;">
Meanwhile, major retailers such as Wal-Mart and Target sell a huge variety of their own products next to the “brand name” products on their shelves <em style="box-sizing: border-box; margin: 0px; padding: 0px;">(See also <a class="lnks" href="http://www.marketing-schools.org/types-of-marketing/shopper-marketing.html" style="background-color: transparent; box-sizing: border-box; color: #0099ff; margin: 0px; outline: none; padding: 0px; text-decoration: none;">Shopper Marketing</a>)</em>. Sam’s Choice is just one of Wal-Mart’s many brands, as Market Pantry is one of Target’s. In both cases, customers who try Sam’s Choice or Market Pantry products develop an expectation of other products sold under the same brand—just as purchasers of Nabisco, Pepsi, Nestle, Heinz, or any of a million other brands do.</div>
</div>
Allcad Serviceshttp://www.blogger.com/profile/12867861373206421561noreply@blogger.com0