Я начинаю с Angular, и у меня есть приведенный ниже код, < /p>
app.component.html => < /p>
{{ title }}
Count is: {{ count }}
Button
< /code>
app.component.ts => < /p>
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>
Эти функции, определенные в файле TS, не стреляют. Не знаю, что здесь не так. Я создал свое приложение с помощью npm init @angular angular-learn команда.
Подробнее здесь: https://stackoverflow.com/questions/784 ... not-firing