© Fu Cheng 2018
Fu ChengBuild Mobile Apps with Ionic 4 and Firebasehttps://doi.org/10.1007/978-1-4842-3775-5_7

7. View Story

Fu Cheng1 
(1)
Sandringham, Auckland, New Zealand
 

After we finish the TopStoriesComponent to list top stories, we are going to allow users to view the actual web pages of stories. In this chapter, we’ll use Cordova InAppBrowser plugin to view web pages.

A Simple Solution

The basic solution is quite simple. We just need to use the standard HTML <a> elements in the item’s template. As in Listing 7-1, we added the <a> element with the attribute href set to item.url. The old div element that contains the URL is removed.
<h2 class="title">
  <a [href]="item.url">{{ item.title }}</a>
</h2>
Listing 7-1

Use <a> for a story’s URL

When we run ...

Get Build Mobile Apps with Ionic 4 and Firebase: Hybrid Mobile App Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.