<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Benjamin RICHARD</title>
    <description>The latest articles on DEV Community by Benjamin RICHARD (@benjamin_richard).</description>
    <link>https://dev.to/benjamin_richard</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2061396%2Ff1614365-878a-4d5e-9fb9-374898f7c122.jpg</url>
      <title>DEV Community: Benjamin RICHARD</title>
      <link>https://dev.to/benjamin_richard</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/benjamin_richard"/>
    <language>en</language>
    <item>
      <title>Yet another Angular article, part 5 : output</title>
      <dc:creator>Benjamin RICHARD</dc:creator>
      <pubDate>Wed, 18 Dec 2024 08:02:34 +0000</pubDate>
      <link>https://dev.to/benjamin_richard/yet-another-angular-article-part-5-output-h46</link>
      <guid>https://dev.to/benjamin_richard/yet-another-angular-article-part-5-output-h46</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzha50e0eny796qlkatz7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzha50e0eny796qlkatz7.png" alt="Image description" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In communication between component you have to define inputs, describes in previous articles, and outputs.&lt;/p&gt;

&lt;p&gt;If inputs are the solution to give information from parent, to children, then outputs allows children to send information to their parents.&lt;/p&gt;

&lt;p&gt;With Angular, outputs are declared in chilren using a signal like this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public myOutput = output&amp;lt;string&amp;gt;();
public setMyOutput = (myOutput: string) =&amp;gt; this.myOutput.emit(myOutput)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And parent component can listen to output with this syntax :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Component({
  ...
  template: `&amp;lt;childrenComponent (myOutput)="setUsername($event)"/&amp;gt;`
})
export class ParentComponent {
  setUsername(username: string) {
    ...
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, output MUST be public. And to listen to output, you MUST use parenthesis, AND use the standard $event variable that is the keyword used everytime in template to bind event.&lt;/p&gt;

&lt;p&gt;That’s all !&lt;/p&gt;

&lt;p&gt;But…&lt;/p&gt;

&lt;p&gt;You can do something else. Here you have to manually ‘emit’ the new value. In fact, the previous output syntax (before v18) was really similar to EventEmitter. So, it was possible to use Observable as Output like this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public @Output() myOutput$ = toObservable(this.myOutput);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each time the Observable changes, an event is emitted. The source of the Observable can be a Subject, or like in my sample, an Observable based on a signal, using toObservable operator.&lt;/p&gt;

&lt;p&gt;That’s all for output parts.&lt;/p&gt;

&lt;p&gt;Have a nice 🌧️ day&lt;/p&gt;

&lt;p&gt;[note] all articles use command from Angular v19*&lt;/p&gt;

&lt;p&gt;[demo] a sample project is available on &lt;a href="https://stackblitz.com/edit/stackblitz-starters-erras7hg" rel="noopener noreferrer"&gt;StackBlitz&lt;/a&gt;&lt;/p&gt;

</description>
      <category>angular</category>
      <category>typescript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Yet another Angular article, part 4 : Input</title>
      <dc:creator>Benjamin RICHARD</dc:creator>
      <pubDate>Tue, 03 Dec 2024 21:59:27 +0000</pubDate>
      <link>https://dev.to/benjamin_richard/yet-another-angular-article-part-4-input-4alb</link>
      <guid>https://dev.to/benjamin_richard/yet-another-angular-article-part-4-input-4alb</guid>
      <description>&lt;p&gt;&lt;a href="https://dev.to/benjamin_richard_ee22ca92/yet-another-angular-article-part-3-configurations-and-environments-23hp"&gt;In my previous article&lt;/a&gt;, we modified the default project configuration. This time, we will create our first components and use Input/Output to bind them together.&lt;/p&gt;

&lt;p&gt;In the second article, you created a HelloWorld component. Please delete the src/app/hello-world folder if it still exists in your project.&lt;/p&gt;

&lt;p&gt;Next, create the HelloWorldForm and HelloWorld components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ng generate component hello-world-form&lt;/li&gt;
&lt;li&gt;ng generate component hello-world&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Edit the main &lt;code&gt;app.component.ts&lt;/code&gt; to use the new component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Component({
  selector: 'app-root',
  imports: [HelloWorldFormComponent],
  template: `
    &amp;lt;h1&amp;gt;Yet another angular article, part 4 : Input&amp;lt;/h1&amp;gt;
    &amp;lt;app-hello-world-form /&amp;gt;
  `,
})
export class App {}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Edit &lt;code&gt;src/app/hello-world-form/hello-world-form.component.ts&lt;/code&gt; like this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {
  ChangeDetectionStrategy,
  Component,
  signal,
  WritableSignal,
} from '@angular/core';
import { HelloWorldComponent } from '../hello-world/hello-world.component';

@Component({
  selector: 'app-hello-world-form',
  imports: [HelloWorldComponent],
  template: `
&amp;lt;input type="text" [value]="username()" (keyup)="setUsername($event)"/&amp;gt;
Hello {{ username() }}
`,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HelloWorldFormComponent {
  username: WritableSignal&amp;lt;string&amp;gt; = signal('');
  setUsername = (ev: Event) =&amp;gt;
    this.username.set((ev.target as HTMLInputElement).value);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In HelloWorldFormComponent, we declare a signal 'username', and use it in the template string with the syntax username() because signals are functions. We use attribute data binding syntax in Angular templates with hooks like [value]="username()". Everything within the quotes is TypeScript code (no need to use the 'this' keyword). This binds TypeScript code to any kind of attributes.&lt;/p&gt;

&lt;p&gt;We also add a setter bound to the input event onKeyup: &lt;code&gt;(keyup)="setUsername($event)"&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Parentheses around attributes signify Angular’s syntax to bind a DOM or component event to a method. The argument $event is the event's output.&lt;/p&gt;

&lt;p&gt;Run the application and enter something in the input field. You should see Hello 'YOUR INPUT VALUE' to the right of the input field.&lt;/p&gt;

&lt;p&gt;Now edit again the &lt;code&gt;src/app/hello-worl/hello-world.component.ts&lt;/code&gt; like this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;imports: [HelloWorldComponent],
template: `
  &amp;lt;input type="text" [value]="username()" (keyup)="setUsername($event)"/&amp;gt;
  &amp;lt;app-hello-world [username]="username"&amp;gt;&amp;lt;/app-hello-world&amp;gt;
`,
Edit src/app/hello-worl/hello-world.component.ts like this :

import { ChangeDetectionStrategy, Component, input } from '@angular/core';

@Component({
  selector: 'app-hello-world',
  template: `Hello {{ username() }}`,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HelloWorldComponent {
  username = input('');
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In HelloWorldComponent, we declare an input 'username' and use it in the template string with the syntax &lt;code&gt;{{ username() }}&lt;/code&gt;. We use input as a signal. This new syntax (since v18) declares an input with a default value of an empty string, making username a Signal.&lt;/p&gt;

&lt;p&gt;Note: Inputs are ReadableSignals only, so you cannot change the signal’s value inside this component. To enable this (and use two-way binding, which is not best practice), you must use model instead of input. Model is a WritableSignal.&lt;/p&gt;

&lt;p&gt;Run the application again. It should function as before, but now each component has a single responsibility.&lt;/p&gt;

&lt;p&gt;If you need the input to be mandatory, use the required option: &lt;code&gt;username = input.required('')&lt;/code&gt;. You can also transform the input by adding a function: &lt;code&gt;username = input.required('', {transform: (value: string) =&amp;gt; value.toUpperCase()})&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That’s all for input parts.&lt;/p&gt;

&lt;p&gt;See you soon under ❄️&lt;/p&gt;

&lt;p&gt;[note] all articles use command from Angular v19*&lt;/p&gt;

&lt;p&gt;[demo] a sample project is available on &lt;a href="https://stackblitz.com/edit/stackblitz-starters-fxmxnx" rel="noopener noreferrer"&gt;StackBlitz&lt;/a&gt;&lt;/p&gt;

</description>
      <category>angular</category>
      <category>typescript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Yet Another Angular Article, Part 3 : configurations and environments</title>
      <dc:creator>Benjamin RICHARD</dc:creator>
      <pubDate>Fri, 29 Nov 2024 14:01:20 +0000</pubDate>
      <link>https://dev.to/benjamin_richard/yet-another-angular-article-part-3-configurations-and-environments-23hp</link>
      <guid>https://dev.to/benjamin_richard/yet-another-angular-article-part-3-configurations-and-environments-23hp</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv6dyatsptes26cv8q3no.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv6dyatsptes26cv8q3no.png" alt="Image description" width="800" height="428"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/benjamin_richard_ee22ca92/yet-another-angular-article-part-2-components-creation-4gpb"&gt;In my previous article&lt;/a&gt;, we learnt how to generate a component. Before going forward, i think that we should have a look at various notions about configurations and environments.&lt;/p&gt;

&lt;p&gt;There is different king of configuration : Angular behavior and typescript compiler. Today we will have a look at the Angular part, and it’s all in angular.json project.&lt;/p&gt;

&lt;p&gt;This file describe all your project, and follow a schema from Angular CLI : /@angular/cli/lib/config/schema.json&lt;/p&gt;

&lt;p&gt;The ‘projects’ is the main part. And in this one, you will see ‘schematics’ and ‘architect’.&lt;/p&gt;

&lt;p&gt;Architect describe the behaviors of the CLI : build, serve, test, …&lt;/p&gt;

&lt;p&gt;Schematics describe how to generate code. And this is what we will do today.&lt;/p&gt;

&lt;p&gt;Here is mine after the first article :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"schematics": {
  "@schematics/angular:component": {
    "style": "scss"
  }
},
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can see that it contains ‘scss’ for the style key. This is because, when i created the project, i answered ‘scss’ to the cli prompt.&lt;/p&gt;

&lt;p&gt;But i want to do more. Ususally i prefer to build component with Single File Component pattern. This is like VueJS does. Your styles, html and typescript code in one file. This is because it forces you to build little component.&lt;br&gt;
To do that, add those lines : inlineStyle and inlineTemplate&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"schematics": {
  "@schematics/angular:component": {
    "style": "scss",
    "inlineStyle": true,
    "inlineTemplate": true
  }
},
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now when you will run ng generate component my-new-component it will create only the typescript file.&lt;/p&gt;

&lt;p&gt;We will continue with some optimizations. Best practices explain that you should always set your Change Detection to ‘OnPush’. So, it should be done during component generation.&lt;br&gt;
To do that, add this line : changeDetection&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"@schematics/angular:component": {
    "style": "scss",
    "inlineStyle": true,
    "inlineTemplate": true,
    "changeDetection": "OnPush"
  }
},
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s it, you now have setup your default project code generation.&lt;/p&gt;

&lt;p&gt;In previous Angular version, you were able to define “standalone: true”. But it’s now the default behavior.&lt;/p&gt;

&lt;p&gt;I will end with Envinronment concept. When you are building application, you usually depends on APIs. These Apis may be served locally (on your computer when you are writing code) but can be served by test-server, pre-production server, or production server.&lt;br&gt;
So you have to set the hostname in a variable.&lt;/p&gt;

&lt;p&gt;Angular bring a kind solution for this : environment.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ng generate environments&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This command will adds 2 new files in your project : environment.ts and environment.development.ts&lt;br&gt;
And it will also modify your angular.json by adding a ‘fileReplacements’ array in the node ‘projects.my-new-project.architect.configurations.development’&lt;/p&gt;

&lt;p&gt;During the build process, it replaces the required environment.ts by the required environment file (environment.development.ts for example).&lt;/p&gt;

&lt;p&gt;You can store all specific environment variablse inside and import the environment.ts everywhere you need it. But take care to not import other environement.*.ts because they won’t be available at runtime !&lt;/p&gt;

&lt;p&gt;Here is a sample of environment :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const environment = {
  production: false,
  calendarApi: {
    host: https://localhost:5000/api/v1,
  }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So you just have to create a new ‘environment.production.ts’ with required variables inside. Then, alter the angular.json to add the fileReplacements section under ‘project.architect.configurations.production’ like this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"fileReplacements": [
  {
    "replace": "src/environments/environment.ts",
    "with": "src/environments/environment.production.ts"
  }
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To my mind, Angular should have create both development and production files. That’s a bit strange.&lt;/p&gt;

&lt;p&gt;Ho, i have forgot to say that in Angular v19, you can define global variable at startup. This might be an alernative to environment concept but it requires more setup on build process.&lt;/p&gt;

&lt;p&gt;Have a nice day ☁️&lt;/p&gt;

&lt;p&gt;[note] All articles use command from Angular v19*&lt;/p&gt;

</description>
      <category>angular</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Yet Another Angular Article, Part 2 : components creation</title>
      <dc:creator>Benjamin RICHARD</dc:creator>
      <pubDate>Fri, 29 Nov 2024 12:54:19 +0000</pubDate>
      <link>https://dev.to/benjamin_richard/yet-another-angular-article-part-2-components-creation-4gpb</link>
      <guid>https://dev.to/benjamin_richard/yet-another-angular-article-part-2-components-creation-4gpb</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqvq834hl51r1eg55vcp7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqvq834hl51r1eg55vcp7.png" alt="Image description" width="800" height="553"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/benjamin_richard_ee22ca92/yet-another-angular-article-part-1-lni"&gt;In the previous article&lt;/a&gt;, i just talked about project creation. I mean, the main project, not sub-projects. Those one will be the subject of a future article.&lt;/p&gt;

&lt;p&gt;Today is related to component creation. And like project creation, the Angular CLI is your best friend. So go an with :&lt;br&gt;
&lt;br&gt;
 &lt;br&gt;
&lt;code&gt;ng generate component hello-world&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;It run the code generation in the folder my-new-project/src/app/hello-world with 4 files :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;hello-world.component.html : the template&lt;/li&gt;
&lt;li&gt;hello-world.component.scss : the styles, in scss format since this is my choice at the project creation prompt&lt;/li&gt;
&lt;li&gt;hello-world.component.spec.ts : the test file&lt;/li&gt;
&lt;li&gt;hello-world.component.ts : the component&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now run ng serve and open the browser to localhost:4200 to see the result&lt;br&gt;
Hey, but the component is not rendered ! Why ?&lt;br&gt;
Because we didn't use it :-)&lt;/p&gt;

&lt;p&gt;Now open the root component 'app.component.ts' and add HelloWorlComponent in 'imports' section :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { HelloWorldComponent } from './hello-world/hello-world.component';
@Component({
 selector: 'app-root',
 imports: [RouterOutlet, HelloWorldComponent],
 templateUrl: './app.component.html',
 styleUrl: './app.component.scss',
})
export class AppComponent {
 title = 'angular-tutorial';
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The component is now available in AppComponent, and we can use it. Just edit the hello-world.component.html file and replace all the code by this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;app-hello-world&amp;gt;&amp;lt;/app-hello-world&amp;gt;
&amp;lt;router-outlet /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Forget router-outlet for instance since we didn't prevent the installation of Angular Router on project creation (if you don't want routing you can do this : ng new my-new-project --routing=false )&lt;/p&gt;

&lt;p&gt;The default selector prefix is 'app', that's why the selector of the component is 'app-hello-world'&lt;/p&gt;

&lt;p&gt;Check the browser and you will see the default content of your component.&lt;/p&gt;

&lt;p&gt;You can customize the css by adding this to hello-world.component.scss :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;:host {
 color: blueviolet
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check the browser and you will see the new color of the text. The :host selector is related to the current hello-world component.&lt;/p&gt;

&lt;p&gt;So now, you know how to generate a simple component&lt;/p&gt;

&lt;p&gt;Have a nice day 🌞&lt;/p&gt;

&lt;p&gt;[original post] &lt;a href="https://rebolon.medium.com/yet-another-angular-article-part-2-components-creation-550c14b991a2" rel="noopener noreferrer"&gt;https://rebolon.medium.com/yet-another-angular-article-part-2-components-creation-550c14b991a2&lt;/a&gt;&lt;/p&gt;

</description>
      <category>angular</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Yet Another Angular Article, Part 1</title>
      <dc:creator>Benjamin RICHARD</dc:creator>
      <pubDate>Fri, 29 Nov 2024 12:51:23 +0000</pubDate>
      <link>https://dev.to/benjamin_richard/yet-another-angular-article-part-1-lni</link>
      <guid>https://dev.to/benjamin_richard/yet-another-angular-article-part-1-lni</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F57yfy7b4tp93yp9ixoe5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F57yfy7b4tp93yp9ixoe5.png" alt="Image description" width="800" height="489"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hey, you know what ? I use Angular, and i like it.&lt;/p&gt;

&lt;p&gt;My name is Benjamin Richard and i work in web industry since 2000. It makes a long time from now. I used to work on backend with PHP, Java or .Net using, most of the time, MVC pattern. MySQL, PostgreSQL, but also Oracle DB was my favourite databases. And when MeteorJs bring their awesome platform, i had a look at frontend technologies.&lt;/p&gt;

&lt;p&gt;Why Angular ? In fact i can't really explain why i worked on Angular, more than React and VueJS. I tried Vue, and developed some applications with it. I liked it. But when it moved from v2 to v3 i didn't understood why they made it so complex, whereas its simplicity was the key part of Vue 1 &amp;amp; 2. So i looked at React and Angular. But, to my mind, Angular was far ahead React even if it was not the opinion of most of developers. To my mind, the fact that Angular bring everything that you need to build an app, is the main advantages. Yes, you can not choose your favorite Http library, your form management, etc. But each part of Angular are made to work well together.&lt;/p&gt;

&lt;p&gt;Why not Angular ? maybe because it was hard to learn it. &lt;br&gt;
Angular = Typescript + RxJS + the Framework&lt;br&gt;
So you have to master each one to be efficient. And it's harder than mastering a template rendering library like React ;-p&lt;br&gt;
But this time is over in 2024. You don't want RxJS ? use signal. Yes, with v16 Angular bring signal concept. in 2024 with v18 most of signals function was stable. and with v19 two new signals bring a new way of working with async resources. So now, you are able to use Angular without Observable. I would say that it's not a good idea, because they are really usefull, but if it's something you don't want, you can preserve yourself from this concept.&lt;/p&gt;

&lt;p&gt;How to start ?&lt;/p&gt;

&lt;p&gt;Since 2024, the Angular team has rebuild the website, so have a look at &lt;a href="https://angular.dev" rel="noopener noreferrer"&gt;https://angular.dev&lt;/a&gt; the content is really impressive.&lt;/p&gt;

&lt;p&gt;Then, you need to get NodeJS &amp;gt;v18.19.1 and you can install it somewhere (using docker or anything else) :&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install -g @angular/cli&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Now that you have the Angular cli, you can use it to start a project :&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ng new my-new-project&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;You have to select some configuration like using a Server side rendering or not, using Sass, Scss, or whatever. And that's all.&lt;/p&gt;

&lt;p&gt;It will create a folder 'my-new-project' with a simple home page. What's great with Angular, is that you can customize your project in the Angular.json file. The schematics part allows you to define how you want to work when you use the Cli to generate some code : &lt;br&gt;
You want html and css in a single file component like Vue ? yes you can. You want to define the Change Detection Strategy ? yes you can.&lt;br&gt;
Everything is under the node projects.my-new-project.schematics&lt;br&gt;
And its default values are defined by using your answers from the 'ng new' command.&lt;br&gt;
Ho, i forgot something : 'ng new' command has a lot of available parameters. But i will let you discover them for instance.&lt;/p&gt;

&lt;p&gt;Now that you project is initialized, it's time to start it :&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ng serve&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Open a browser on &lt;a href="http://localhost:4200" rel="noopener noreferrer"&gt;http://localhost:4200&lt;/a&gt; and that's it.&lt;/p&gt;

&lt;p&gt;This article is over and next one will be about component creation.&lt;/p&gt;

&lt;p&gt;See you !&lt;/p&gt;

&lt;p&gt;[note] All articles use command from Angular v19*&lt;br&gt;
[original post] &lt;a href="https://medium.com/@rebolon/yet-another-angular-article-part-1-8f9ae6526189" rel="noopener noreferrer"&gt;https://medium.com/@rebolon/yet-another-angular-article-part-1-8f9ae6526189&lt;/a&gt;&lt;/p&gt;

</description>
      <category>angular</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
