Skip to main content

Posts

Showing posts with the label How to display data in angular component

How to display text in angular component?

Let’s take an example and understand more about Data Display. In our example, we will look at displaying the values of the various properties in our class in an HTML page. Step 1  − Change the code of the app.component.ts file to the following. import { Component } from '@angular/core' ; @Component ({ selector : 'my-app' , templateUrl : 'app/app.component.html' }) export class AppComponent { TutorialName : string = 'Angular JS2' ; appList : string [] = [ "Binding" , "Display" , "Services" ]; } Following points need to be noted about the above code. We are defining an array called appList which of the type string. We are defining 3 string elements as part of the array which is Binding, Display, and Services. We have also defined a property called TutorialName which has a value of Angular 2. Step 2  − Make the following changes to the app/app.component.html file w...