首页 > 其他 > 详细

[Angular 2] Event in deep

时间:2016-03-20 07:03:03      阅读:218      评论:0      收藏:0      [点我收藏+]

This lesson talks about the benefits of using the parens-based (click) syntax so that Angular 2 can handle any custom event. Then the video explains how to pass in the actually event object using the familiar $event syntax.

 

import {Component} from ‘angular2/core‘;
import {bootstrap} from ‘angular2/bootstrap‘;

@Component({
    selector: ‘app‘,
    template: `
    <div>
            <input type="text" #myInput>
            <button (mouseenter)="onClick($event, myInput.value)">Click Me</button>
        </div>
    `
})

class App{
    onClick(event, value: string){
        console.log(event, value);
    }
}

bootstrap(App);

 

[Angular 2] Event in deep

原文:http://www.cnblogs.com/Answer1215/p/5297071.html

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