import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
@Component({
selector: 'app-root',
standalone: true,
imports: [RouterOutlet],
templateUrl: './app.component.html',
styleUrl: './app.component.css',
})
export class AppComponent {
title = 'Angular Learn';
count = 1;
updateCount() {
this.count++;
}
myFunction() {
console.log('Title Clicked');
alert('Title Clicked');
}
}
< /code>
The functions defined in the TS file are not firing. No idea what is wrong here. I created my app using the [b]npm init @angular angular-learn
Я начинаю с Angular, и у меня есть приведенный ниже код. < /p> [code]app.component.html[/code]: [code]{{ title }} Count is: {{ count }} Button < /code> app.component.ts[/code]: [code]import { Component } from '@angular/core'; import { RouterOutlet } from '@angular/router';
@Component({ selector: 'app-root', standalone: true, imports: [RouterOutlet], templateUrl: './app.component.html', styleUrl: './app.component.css', }) export class AppComponent { title = 'Angular Learn';
count = 1;
updateCount() { this.count++; }
myFunction() { console.log('Title Clicked'); alert('Title Clicked'); } } < /code> The functions defined in the TS file are not firing. No idea what is wrong here. I created my app using the [b]npm init @angular angular-learn[/code] [/b] команда.