[英]angular 2 parent and child component
https://jsfiddle.net/t9ef4cdt/
@Component({
selector: 'child',
template: `
<div>
<h2>{{name}}</h2>
<button (click) = "rename()" > Rename Parent </button>
</div>
`,
})
export class Child {
@Input() name:string;
@Output() nameChanged: EventEmitter<string> = new EventEmitter<string>()
問題是您正在使用不推薦使用的Angular版本(因為它出現在您的導入中),您可以在這里找到您的代碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.