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.

  1. import {Component} from 'angular2/core';
  2. import {bootstrap} from 'angular2/bootstrap';
  3.  
  4. @Component({
  5. selector: 'app',
  6. template: `
  7. <div>
  8. <input type="text" #myInput>
  9. <button (mouseenter)="onClick($event, myInput.value)">Click Me</button>
  10. </div>
  11. `
  12. })
  13.  
  14. class App{
  15. onClick(event, value: string){
  16. console.log(event, value);
  17. }
  18. }
  19.  
  20. bootstrap(App);

[Angular 2] Event in deep的更多相关文章

  1. angular 实现tab切换(循环输出tab标题及tab下属内容,非direct,非include)

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script sr ...

  2. angular(常识)

    我觉得angularjs是前端框架,而jquery只是前端工具,这两个还是没有可比性的. 看知乎上关于jquery和angular的对比http://www.zhihu.com/question/27 ...

  3. angular下H5上传图片(可多张上传)

    最近做的项目中用到了angular下上传图片功能,在做的过程中遇到了许多问题,最终都得以解决 angular上传时和普通上传时过程差不多,只不过是要不一些东西转化为angular的东西. 1.ng-f ...

  4. firefox 的event事件处理

    前几天,在用angularJs实现一个功能,点击后获取event的x,y坐标时,IE9, chrome下功能正常.但是firefox报event 未定义.初始代码如下: html: <div c ...

  5. angular面试记忆的内容

    1.ng-class的用法:ng-class="{red:true}"; 2.ng-repeat怎么可以添加重复数据.ng-repeat="item in arr tra ...

  6. angular.js中提供的基础方法

    angular.bind angular.callbacks angular.equals /* *Determines if two objects or two values are equiva ...

  7. Promise in AngularJS

    What's promise Angular’s event system provides a lot of power to our Angular apps. One of the most p ...

  8. 用postal.js在AngularJS中实现订阅发布消息

    点击查看AngularJS系列目录 用postal.js在AngularJS中实现event bus 用postal.js在AngularJS中实现event bus 理想状态下,在一个Angular ...

  9. face recognition[翻译][深度人脸识别:综述]

    这里翻译下<Deep face recognition: a survey v4>. 1 引言 由于它的非侵入性和自然特征,人脸识别已经成为身份识别中重要的生物认证技术,也已经应用到许多领 ...

随机推荐

  1. Linux进程调度与切换

    2016-04-15 张超<Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 一.分析 进程调度的时机与进程 ...

  2. ubuntu server 14.04.4 无线网卡没有启用,找不到wlan0端口

    Ubuntu Server默认的情况下是不会启用无线网卡的,想想实际服务器上怎么可能有无线网卡呢,呵呵.所以我们需要手动来启用无线网卡,难点就在这里了. 使用ifconfig命令,发现没有wlan口, ...

  3. jquery 中ajax的参数

    url: 要求为String类型的参数,(默认为当前页地址)发送请求的地址. type: 要求为String类型的参数,请求方式(post或get)默认为get.注意其他http请求方法,例如put和 ...

  4. (转) C# Activator.CreateInstance()方法使用

    C#在类工厂中动态创建类的实例,所使用的方法为: 1. Activator.CreateInstance (Type) 2. Activator.CreateInstance (Type, Objec ...

  5. Objective-C Delegate

    ios设计模式中的委托 Delegate 官方文档解释如下: Delegation is a simple and powerful pattern in which one object in a ...

  6. 12 hdfs常用文件、目录拷贝操作、删除操作

    package com.da.hbase.tool.utils; import com.da.hbase.tool.common.Const; import org.apache.hadoop.con ...

  7. OSG调试信息显示

    调试信息显示 OSG 可以将各式各样的调试信息输出到std:cout.这在开发OSG 程序时十分有用,你可以借此观察OSG 的执行的各种操作.环境变量OSG_NOTIFY_LEVEL用于控制OSG调试 ...

  8. Asp.Net页面生命周期--转发(学海无涯)

    一.什么是Asp.Net页面生命周期 当我们在浏览器地址栏中输入网址,回车查看页面时,这时会向服务器端(IIS)发送一个request请求,服务器就会判断发送过来的请求页面,  完全识别 HTTP 页 ...

  9. JSP中页面定时刷新

    1.JSP中页面定时刷新 <% //页面每隔30秒自动刷新一遍 response.setHeader("refresh" , "30" ); %> ...

  10. php 之 数据访问 增删改查

    一.建立主页面: <title>主页面</title> </head> <body> <h1>主页面</h1> <tabl ...