首页 > 其他 > 详细

angular4-事件绑定

时间:2017-09-01 09:27:24      阅读:356      评论:0      收藏:0      [点我收藏+]

事件绑定语法(可以通过 (事件名) 的语法,实现事件绑定)

<date-picker (dateChanged)="statement()"></date-picker>
等价于<date-picker on-dateChanged="statement()"></date-picker>
@Component({
    selector: sl-user,
    template: `
    <button (click)="toggleSkills()">
        {{ showSkills ? "隐藏技能" : "显示技能" }}
    </button>
    `
})
export class UserComponent {
    toggleSkills() {
        this.showSkills = !this.showSkills;
    }
}

 

angular4-事件绑定

原文:http://www.cnblogs.com/avidya/p/7461323.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!