---
description: Angular Building Blocks
---

# Recap

In this section we reviewed the main parts of an angular app, Modules and Components.  Each angular app must have one root module, **app.module.ts** and a root component, **app.component.ts**. &#x20;

**Components** are smaller blocks of code that have their own HTML, CSS, and Typescript.  In larger applications angular apps can have many modules that contain their respective components.  Modules and components are just to help us organize our code and make it more reusable and composable, just like writing small functions. Our apps main html selector can be found in the _**app.component.ts**_ and is used in the _**index.html**_. All other components we make will be children of the _**app.component.html**_.

{% tabs %}
{% tab title="index.html" %}
```markup
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>DemoApp</title>
  <base href="/">

  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
  <app-root></app-root>
</body>
</html>

```
{% endtab %}

{% tab title="app.component.ts" %}
```typescript
import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  title = 'demo-app';
}

```
{% endtab %}

{% tab title="app.module.ts" %}
```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

```
{% endtab %}
{% endtabs %}

#### **Understand how** the lines from the above files connect.

* [ ] **Line 12:** _index.html_
* [ ] **Line 4 :** _app.component.html_
* [ ] _**Line  5, 9 & 16:** app.module.ts_&#x20;

## **Key Concepts:**

* Every angular app has a _**app.module.ts**_ for its root module
* App.module.ts is the _**heart of our application**_, all components and modules we need, must be imported here.
* Every angular app has an _**app.component.ts**_  for its main component, that is placed in the _**index.html.**_
* Larger angular apps can have multiple modules that contain multiple components, we will not be creating apps that large, however.&#x20;
* Components are small reusable code that have their own **HTML, CSS and Typescript** files
* Each angular component has a unique **html selector** and can be used just like a normal HTML tag.
* Each angular file name has what angular building block it is in the filename.\

  * app.component.ts
  * foo.component.ts
  * header.component.ts
  * app.module.ts

{% hint style="success" %}
We now understand the default angular application and the main structure of an angular app.
{% endhint %}
