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的更多相关文章

  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. Android设置里面默认存储器选项(default write disk)的实现

    原生的Android设置里面没有默认存储器的选项,可是MTK偏偏加上了这个功能,可能MTK认为这个比較实用吧,所以,他们在原生的基础上面做了改动.加上了这个功能.可是高通平台没有这个功能.相对MTK来 ...

  2. css变形几大属性

    1.transform: transform-function() * | none; transform-function: translate().scale().rotate().skew(). ...

  3. FileDirLocationOperator - 文件或目录位置操作.

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Move ...

  4. Dom4j之xPath

    XPath 是一门在 XML 文档中查找信息的语言.XPath 可用来在 XML 文档中对元素和属性进行遍历. XPath 是 W3C XSLT 标准的主要元素,并且 XQuery 和 XPointe ...

  5. 后台构建 html 字符串传到前台字符串转码(html)处理

    知识在于总结,那就记下了吧! 例如后台 html 字符串是 var htmlStr="后台html字符串": 转码 var html格式代码=decodeHtml(htmlStr) ...

  6. 解决IE10以下对象不支持“bind”属性或方法

    IE10一下的浏览器,如果在JS代码中用了bind函数,那么就会报“SCRIPT438: 对象不支持“bind”属性或方法” 因为浏览器没有提供这个参数的方法,所以我们就自己写一个bind,来让这个参 ...

  7. 转载自php 大牛的学习计划 人生规划

    2012年偶决定开始写博客了,不为别的,就希望可以通过博客记录我的成长历程同时也希望可以帮助一些刚毕业,刚入行业的兄弟姐们们.我们是一群充满浮躁.抱怨.迷茫的程序猿,想一想3年就这么过去了,社会变得更 ...

  8. php目录分隔符DIRECTORY_SEPARATOR

    在windows我们习惯性的使用“\”作为文件分隔符,但是在linux上系统不认识这个标识,于是就要引入这个php内置变量了:DIRECTORY_SEPARATOR 路径分隔符 windows \ o ...

  9. Python新手学习基础之数据类型——字符串的切片截取

    切片截取是python中字符串常见的一些操作,我们会在这篇文章里详细介绍,切片截取的作用是获取子字符或子字符串. 实际上,我们要做的就是使用索引,用冒号分隔两个索引,形式为:变量[头下标:尾下标],冒 ...

  10. BufferedInputStream

    package file; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStrea ...