0
저는 Angular2를 사용하고 있습니다. 이러한 기능을 변경하면 아무런 변화가 없음을 알 수 없습니다.Angular2가 작동하지 않는 (클릭) 기능으로 변경됨
//home.component.html
<div class="ui container">
<sm-button class="positive" (click)="remove()">Button</sm-button>
</div>
//home.component.ts
import { Component } from "@angular/core";
@Component({
selector: "home",
templateUrl: `client/components/home/home.component.html`
})
export class HomeComponent {
constructor() {}
remove() {
console.log("Hello");
}
}
을하지만 나는이 변경 : 그래서 내 코드는 먼저 다음과 같습니다 말할
버튼을 클릭하면 이제로드 기능을 찾을 수 없습니다//home.component.html
<div class="ui container">
<sm-button class="positive" (click)="load()">Button</sm-button>
</div>
//home.component.ts
import { Component } from "@angular/core";
@Component({
selector: "home",
templateUrl: `client/components/home/home.component.html`
})
export class HomeComponent {
constructor() {}
load() {
console.log("Hello");
}
}
. 여기서 무슨 일이 일어나고있는거야?
편집 : 변경 코드는
템플릿을'@ Component'에 추가하십시오 –
컴파일하는 것을 잊었습니까? 전후에 두 파일을 올리면 도움이됩니다. –
예. 템플릿은 버튼을로드하고 클릭하면 클릭 기능이 제거되면 작동합니다. home.component.ts에서 변경 한 내용은 실제로 아무 것도하지 않는 것과 같습니다. 왜 그런 일이 일어날까요? 나는 라이트 서버를 실행하여 변경시 자동으로 컴파일해서는 안되며 수동으로 컴파일해야합니까? – awillis