© Fu Cheng 2017

Fu Cheng, Build Mobile Apps with Ionic 2 and Firebase, 10.1007/978-1-4842-2737-4_5

5. View Story

Fu Cheng

(1)Sandringham, Auckland, New Zealand

After we finished the TopStoriesPage to list top stories, we are going to allow users to view the actual web pages of stories. The basic solution is quite simple. We just need to use the standard HTML <a> elements in the item’s template. As in Listing 5-1, we added the <a> element with the href attribute set to item.url. The old div element that contains the url is removed.

Listing 5-1. Use <a> for a story’s URL
<h2 class="title">  <a [href]="item.url">{{ item.title }}</a></h2>

When we run the code inside of an emulator or a device, clicking the title opens the platform default browser and shows ...

Get Build Mobile Apps with Ionic 2 and Firebase: Hybrid Mobile App Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.