English 中文(简体)
Angular 17 button (click) activity not work
原标题:Angular 17 button (click) event not working
The bounty expires in 7 days. Answers to this question are eligible for a +50 reputation bounty. NeuseelandRotVogel wants to draw more attention to this question:
I am having the exact same issue as this user and nobody is able to explain the error why button clicks are not firing in Angular 17. Everybody is just saying "works fine for me" or "try this". Well, none of that works. I get 0 error messages and this is driving me insane. Right now my buttons don t work unless they re an <a href> tag. I m looking for someone to explain what the error here is and how to resolve it.

我有一个叫做“功能网吧”。 由于某种原因,这次活动根本不可行。 这里是法典:TS文档:

  fun(): void {
    this.test =  You are my hero! ;
    alert( hello )
  }

和超文本:

<button type="button" (click)="fun()">Click me!</button>

我对我做错做的事情没有任何想法。 请帮助我。

问题回答

你的法典似乎正在做罚款。 如果你工作困难,请参见下文中的工作部分。

www.un.org/spanish/ecosoc 检查该工作代码样本:

www.un.org/spanish/ecosoc 请见https://angular-bfjiyg-jdng4j.stackblitz.io” rel=“nofollow noretinger”>here。

app.component.ts :

import { Component } from  @angular/core ;

@Component({
  selector:  app-root ,
  templateUrl:  ./app.component.html ,
  styleUrls: [ ./app.component.css ],
})
export class AppComponent {
  test: string;
  count: number = 0;


  fun(): void {
    this.test =  You are my hero! ;
    this.count++;
    alert( Test message : +this.test+  Count : +this.count);
  }
}

app.component.html:

<div class="container">
  <button type="button" (click)="fun()">Click me!</button>
</div>

我不相信这是解决你问题的办法,但对于我来说,我来说,通过帮助恢复申请和内容。

我认为,我自己确定的问题是,由于我删除了这些档案,我有一些“相容的光谱”和“科学”档案。 因此,我想到的是,Angular不希望你去除这些档案,在某个地方造成冲突,因为“some笑”必须先看这些档案,不能,而只是不适当工作。

为此,

    import {Component} from  @angular/core ;

@Component({
  selector:  home ,
  templateUrl:  src/home/home.html 
})
export class HomeComponent {
  content: string = "";
  count: number = 0;
  
  setMessage1 () {
    this.content =  This is message # 1 ;
  }
}

Button Point

<button (click)="setMessage1()">
Set Message # 1
</button>




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签