2017-02-22 13:09:39 -05:00
|
|
|
@title
|
|
|
|
Tutorial: Tour of Heroes
|
|
|
|
|
|
|
|
@intro
|
|
|
|
The Tour of Heroes tutorial takes you through the steps of creating an Angular application in TypeScript.
|
|
|
|
|
|
|
|
@description
|
|
|
|
|
2017-03-31 19:57:13 -04:00
|
|
|
|
|
|
|
|
2017-03-27 11:08:53 -04:00
|
|
|
The grand plan for this tutorial is to build an app that helps a staffing agency manage its stable of heroes.
|
|
|
|
|
|
|
|
The Tour of Heroes app covers the core fundamentals of Angular. You'll build a basic app that
|
|
|
|
has many of the features you'd expect to find in a full-blown, data-driven app: acquiring and displaying
|
2017-02-22 13:09:39 -05:00
|
|
|
a list of heroes, editing a selected hero's detail, and navigating among different
|
|
|
|
views of heroic data.
|
|
|
|
|
2017-03-27 11:08:53 -04:00
|
|
|
You'll use built-in directives to show and hide elements and display lists of hero data.
|
|
|
|
You'll create components to display hero details and show an array of heroes.
|
|
|
|
You'll use one-way data binding for read-only data. You'll add editable fields to update a model
|
|
|
|
with two-way data binding. You'll bind component methods to user events, like keystrokes and clicks.
|
|
|
|
You'll enable users to select a hero from a master list and edit that hero in the details view. You'll
|
|
|
|
format data with pipes. You'll create a shared service to assemble the heroes.
|
|
|
|
And you'll use routing to navigate among different views and their components.
|
|
|
|
<!-- CF: Should this be a bullet list? -->
|
|
|
|
|
|
|
|
You'll learn enough core Angular to get started and gain confidence that
|
|
|
|
Angular can do whatever you need it to do.
|
|
|
|
You'll cover a lot of ground at an introductory level, and you'll find many links
|
|
|
|
to pages with greater depth.
|
2017-02-22 13:09:39 -05:00
|
|
|
|
2017-04-21 20:21:45 -04:00
|
|
|
When you're done with this tutorial, the app will look like this <live-example name="toh-pt6"></live-example>.
|
2017-02-22 13:09:39 -05:00
|
|
|
|
|
|
|
|
2017-03-31 19:57:13 -04:00
|
|
|
|
|
|
|
|
2017-03-27 11:08:53 -04:00
|
|
|
## The end game
|
2017-02-22 13:09:39 -05:00
|
|
|
|
2017-03-27 11:08:53 -04:00
|
|
|
Here's a visual idea of where this tutorial leads, beginning with the "Dashboard"
|
|
|
|
view and the most heroic heroes:
|
2017-02-22 13:09:39 -05:00
|
|
|
|
2017-03-30 15:04:18 -04:00
|
|
|
|
2017-02-22 13:09:39 -05:00
|
|
|
<figure class='image-display'>
|
2017-04-21 20:59:33 -04:00
|
|
|
<img src='assets/images/guide/toh/heroes-dashboard-1.png' alt="Output of heroes dashboard"></img>
|
2017-02-22 13:09:39 -05:00
|
|
|
</figure>
|
|
|
|
|
2017-03-31 19:57:13 -04:00
|
|
|
|
|
|
|
|
2017-03-27 11:08:53 -04:00
|
|
|
You can click the two links above the dashboard ("Dashboard" and "Heroes")
|
|
|
|
to navigate between this Dashboard view and a Heroes view.
|
2017-02-22 13:09:39 -05:00
|
|
|
|
2017-03-27 11:08:53 -04:00
|
|
|
If you click the dashboard hero "Magneta," the router opens a "Hero Details" view
|
|
|
|
where you can change the hero's name.
|
2017-02-22 13:09:39 -05:00
|
|
|
|
2017-03-30 15:04:18 -04:00
|
|
|
|
2017-02-22 13:09:39 -05:00
|
|
|
<figure class='image-display'>
|
2017-04-21 20:59:33 -04:00
|
|
|
<img src='assets/images/guide/toh/hero-details-1.png' alt="Details of hero in app"></img>
|
2017-02-22 13:09:39 -05:00
|
|
|
</figure>
|
|
|
|
|
2017-03-31 19:57:13 -04:00
|
|
|
|
|
|
|
|
2017-03-27 11:08:53 -04:00
|
|
|
Clicking the "Back" button returns you to the Dashboard.
|
|
|
|
Links at the top take you to either of the main views.
|
|
|
|
If you click "Heroes," the app displays the "Heroes" master list view.
|
2017-02-22 13:09:39 -05:00
|
|
|
|
2017-03-30 15:04:18 -04:00
|
|
|
|
2017-02-22 13:09:39 -05:00
|
|
|
<figure class='image-display'>
|
2017-04-21 20:59:33 -04:00
|
|
|
<img src='assets/images/guide/toh/heroes-list-2.png' alt="Output of heroes list app"></img>
|
2017-02-22 13:09:39 -05:00
|
|
|
</figure>
|
|
|
|
|
2017-03-31 19:57:13 -04:00
|
|
|
|
|
|
|
|
2017-03-27 11:08:53 -04:00
|
|
|
When you click a different hero name, the read-only mini detail beneath the list reflects the new choice.
|
2017-02-22 13:09:39 -05:00
|
|
|
|
2017-03-27 11:08:53 -04:00
|
|
|
You can click the "View Details" button to drill into the
|
|
|
|
editable details of the selected hero.
|
2017-02-22 13:09:39 -05:00
|
|
|
|
2017-03-27 11:08:53 -04:00
|
|
|
The following diagram captures all of the navigation options.
|
2017-02-22 13:09:39 -05:00
|
|
|
|
2017-03-30 15:04:18 -04:00
|
|
|
|
2017-02-22 13:09:39 -05:00
|
|
|
<figure class='image-display'>
|
2017-04-21 20:59:33 -04:00
|
|
|
<img src='assets/images/guide/toh/nav-diagram.png' alt="View navigations"></img>
|
2017-02-22 13:09:39 -05:00
|
|
|
</figure>
|
|
|
|
|
2017-03-31 19:57:13 -04:00
|
|
|
|
|
|
|
|
2017-03-27 11:08:53 -04:00
|
|
|
Here's the app in action:
|
2017-02-22 13:09:39 -05:00
|
|
|
|
2017-03-30 15:04:18 -04:00
|
|
|
|
2017-02-22 13:09:39 -05:00
|
|
|
<figure class='image-display'>
|
2017-04-21 20:59:33 -04:00
|
|
|
<img src='assets/images/guide/toh/toh-anim.gif' alt="Tour of Heroes in Action"></img>
|
2017-02-22 13:09:39 -05:00
|
|
|
</figure>
|
|
|
|
|
|
|
|
|
2017-03-31 19:57:13 -04:00
|
|
|
|
|
|
|
|
2017-03-27 11:08:53 -04:00
|
|
|
## Up next
|
2017-02-22 13:09:39 -05:00
|
|
|
|
2017-03-27 11:08:53 -04:00
|
|
|
You'll build the Tour of Heroes app, step by step.
|
|
|
|
Each step is motivated with a requirement that you've likely
|
|
|
|
met in many applications. Everything has a reason.
|
2017-02-22 13:09:39 -05:00
|
|
|
|
2017-03-27 11:08:53 -04:00
|
|
|
Along the way, you'll become familiar with many of the core fundamentals of Angular.
|