DEV Community

loizenai
loizenai

Posted on

1

Create a new Angular 4 Component – Multiple Components Angular Application

https://grokonez.com/frontend/angular/create-new-angular-4-component-multiple-components

Create a new Angular 4 Component – Multiple Components Angular Application

The previous post, We had introduced how to set up an Angular 4 App with SpringBootSuite. In the tutorial, JavaSampleApproach will show you how to create a new Angular 4 Component and build an Angular Application with multiple Components.

Angular 6:

Related articles:

I. Technologies

– Angular 4
– SpringToolSuite: Version: 3.8.0.RELEASE

II. Angular Component

Example:

import { Component, OnInit } from '@angular/core';
import { Customer } from './customer';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})

export class AppComponent implements OnInit {
  customers: Customer[];
  selectedCustomer: Customer;

  constructor() {}

  getCustomers() {
     ...
  }

  ngOnInit(): void {
     this.customers = this.getCustomers();
  }

}

What is Component?
-> Component is a basic building block of Angular Application. It allows us to mark a logic class, and additional metadata for processing at runtime. Components have a template (in above code is './app.component.html') and only one component can be instantiated per an element in a template.
A component must belong to an NgModule. So you should declare it in a NgModule:

More at:

https://grokonez.com/frontend/angular/create-new-angular-4-component-multiple-components

Create a new Angular 4 Component – Multiple Components Angular Application

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

nextjs tutorial video

Youtube Tutorial Series 📺

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series 👀

Watch the Youtube series

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay