Angular – Understanding Templates

On the first part of the Angular components series, we talked about the Angular core components. This time, we will discuss templates.

Basically, Templates is defined as the “view” and the “controller” is defined in the class. This is one of the properties of Component, which is a type of directive that has a controller and a view.

Let’s start with the basics of enhancing our templates. We will make a simple list of stocks and make it show on your browser.

  • First, we made a string type variable named ‘title’ and an array named ‘stocks’
  • Next we injected the ‘title’ in the template and used an unordered list with the Directive *ngFor to display our array.
  • Save your work and go to your browser and you’re done.

templates

On the next article, you will learn how to create and use Components.

Subscribe Now and Upgrade Your Skills Today!
Sign up now and have the latest tech tutorials delivered straight to your mailbox.

PLUS: Get exclusive member-only discounts (up to 80% OFF!!) on our top tech courses in Udemy!
We hate spam. Your email address will not be sold or shared with anyone else.