Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,15 @@
"outputPath": "dist/rero-angular",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": [
"zone.js"
],
"polyfills": ["zone.js"],
"tsConfig": "tsconfig.app.json",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"src/styles.css"
],
"styles": ["src/styles.css"],
"scripts": []
},
"configurations": {
Expand Down Expand Up @@ -73,20 +69,15 @@
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"polyfills": ["zone.js", "zone.js/testing"],
"tsConfig": "tsconfig.spec.json",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"src/styles.css"
],
"styles": ["src/styles.css"],
"scripts": []
}
}
Expand Down
Empty file removed src/app/app.component.css
Empty file.
336 changes: 0 additions & 336 deletions src/app/app.component.html

This file was deleted.

29 changes: 0 additions & 29 deletions src/app/app.component.spec.ts

This file was deleted.

59 changes: 54 additions & 5 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,61 @@
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { User } from './user.component';
import { Child } from './child.component';

@Component({
selector: 'app-root',
imports: [RouterOutlet],
templateUrl: './app.component.html',
styleUrl: './app.component.css'
template: `
<section (mouseover)="onMouseOver()">
<app-user name="Simran"></app-user>

@if (isServerRunning) {
<p>Yes, the server is running</p>
} @else {
<p>No, the server is not running</p>
}

<h2>Users list :</h2>
@for (user of users; track user.id) {
<p>{{ user.name }}</p>
}

<p>{{ message }}</p>
</section>

<div [contentEditable]="isEditable">This text can be edited</div>
<app-child (addItemEvent)="addItem($event)"></app-child>
`,

imports: [User, Child],
standalone: true,
styles: [
`
:host {
color: #a144eb;
}
`,
],
})
export class AppComponent {
title = 'Rero-Angular';
city = 'San Francisco';
isServerRunning = true; // Boolean flag to indicate server status

users = [
{ id: 0, name: 'Sarah' },
{ id: 1, name: 'Amy' },
{ id: 2, name: 'Rachel' },
{ id: 3, name: 'Jessica' },
{ id: 4, name: 'Poornima' },
];

isEditable = true; // Boolean flag to indicate if the component is editable
message = ''; // Message to display on mouseover

onMouseOver() {
this.message = 'Way to go';
}

addItem(newItem: string) {
this.users.push({ id: this.users.length, name: newItem }); // Add the new item to the users list
}
}
8 changes: 0 additions & 8 deletions src/app/app.config.ts

This file was deleted.

9 changes: 9 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';

@NgModule({
imports: [BrowserModule, AppComponent],
bootstrap: [AppComponent],
})
export class AppModule {}
3 changes: 0 additions & 3 deletions src/app/app.routes.ts

This file was deleted.

15 changes: 15 additions & 0 deletions src/app/child.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, output } from '@angular/core';

@Component({
selector: 'app-child',
standalone: true,
template: ` <button (click)="addItem()">Add Item</button> `,
})
export class Child {
// 👉 Output property (type string)
addItemEvent = output<string>();

addItem() {
this.addItemEvent.emit('🐢');
}
}
10 changes: 10 additions & 0 deletions src/app/user.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component, input } from '@angular/core';

@Component({
selector: 'app-user',
template: `<p>The user's name is {{ name() }}</p>`,
standalone: true,
})
export class User {
name = input<string>(); // Input property for the user's name
}
3 changes: 3 additions & 0 deletions src/environments/environment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const environment = {
production: false,
};
22 changes: 10 additions & 12 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>ReroAngular</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>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8" />
<title>Rero Angular</title>
<base href="/" />
</head>
<body>
<app-root></app-root>
</body>
</html>
15 changes: 11 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { bootstrapApplication } from '@angular/platform-browser';
import { appConfig } from './app/app.config';
import { AppComponent } from './app/app.component';
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

bootstrapApplication(AppComponent, appConfig)
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

if (environment.production) {
enableProdMode();
}

platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch((err) => console.error(err));
1 change: 0 additions & 1 deletion src/styles.css
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
/* You can add global styles to this file, and also import other style files */