一、Input Helpers

Ember中{{input}}{{textarea}}是创建常规表单控件最简单的方法。

{{input}}包裹内建的Ember.TextFieldEmber.Checkbox视图,然而{{textarea}}包裹Ember.TextArea。使用这些辅助器,你可以用这些声明创建这些视图,和你直接创建<input><textarea>几乎相同。

二、Text Fieleds

{{input value="http://www.facebook.com"}}

HTML:

<input type="text" value="http://www.facebook.com"/>

你可以向input helper传递下面这些标准的<input>属性:

`readonly` `required` `autofocus`
`value` `placeholder` `disabled`
`size` `tabindex` `maxlength`
`name` `min` `max`
`pattern` `accept` `autocomplete`
`autosave` `formaction` `formenctype`
`formmethod` `formnovalidate` `formtarget`
`height` `inputmode` `multiple`
`step` `width` `form`
`selectionDirection` `spellcheck`  

如果这些属性被字符串包括,它们的值将被直接设置到元素上。如果没有引号,这些值将被绑定到模板当前渲染上下文的一个属性。

example:

{{input type="text" value=firstName disabled=entryNotAllowed size="50"}}

将绑定disalbed属性绑定到当前上下文中entryNotAllowed 值。

三、Actions

为一个action派遣一个特定事件,例如enter或者key-press

{{input value=firstName key-press="updateFirstName"}}

四、CheckBoxes

你也可以通过设置type,使用{{input}}去创建一个checkbox。

{{input type="checkbox" name="isAdmin" checked=isAdmin}}

Checkboxes支持以下属性:

  • checked
  • disabled
  • tabindex
  • indeterminate
  • name
  • autofocus
  • form

它可以绑定或设置如前一节中所述。

五、Text Areas

{{textarea value=name cols="80" rows="6"}}

将会绑定textarea的值到当前上下文中的name

{{textarea}}支持下面属性:

  • value
  • name
  • rows
  • cols
  • placeholder
  • disabled
  • maxlength
  • tabindex
  • selectionEnd
  • selectionStart
  • selectionDirection
  • wrap
  • readonly
  • autofocus
  • form
  • spellcheck
  • required

3.9 Templates -- Input Helpers的更多相关文章

  1. 3.10 Templates -- Development Helpers

    一.Development Helpers Handlebar和Ember有好多个辅助器可以使模板开发更容易. 这些辅助器输出变量到浏览器的控制台,或者从模板中激活debugger. 二.Loggin ...

  2. 3.12 Templates -- Wrting Helpers(编写辅助器)

    一.概述 1. Helpers允许你向你的模板添加超出在Ember中开箱即用的额外的功能.辅助器是最有用的,用于将来自模型和组件的原始值转换成更适合于用户的格式. 2. 例如,假设我们有一个Invoi ...

  3. jquery-jsrender使用

      JsRender是一款基于jQuery的JavaScript模版引擎 特点: · 简单直观 · 功能强大 · 可扩展的 · 快如闪电 jsrender使用比较简单,本文简单结束一些常用的 使用过程 ...

  4. Ember.js学习教程 -- 目录

    写在前面的话: 公司的新项目需要用到Ember.js,版本为v1.13.0.由于网上关于Ember的资料非常少,所以只有硬着头皮看官网的Guides,为了加深印象和方便以后查阅就用自己拙劣的英语水平把 ...

  5. Magento架构分析,Magento MVC 设计分析

    Magento架构分析,Magento MVC 设计分析 分类:Magento 标签:Magento MVC.Magento架构 669人浏览 Magento 采用类似 JAVA的架构,其扩展与稳定性 ...

  6. PA教材提纲 TAW10-2

    Unit1 Introduction to the ABAP Dictionary(ABAP字典介绍) 1.1 Describing the ABAP Dictionary(描述ABAP字典) ABA ...

  7. JavaScript-Tool:Moment.js

    ylbtech-JavaScript-Tool:Moment.js Parse, validate, manipulate, and display dates and times in JavaSc ...

  8. 【SpringBoot】11-1.Springboot整合Springmvc+Mybatis增删改查操作(下)

    整合过程:https://www.isdxh.com/68.html 一.增--增加用户 1.创建实体类 package com.dxh.pojo; public class Users { priv ...

  9. 3.11 Templates --Rendering with Helpers

    Ember提供几个辅助器允许你使用不同的方法渲染模板(render templates). 一.The {{partial}} Helper {{partial}}以呈现的模板作为参数,并在这里呈现模 ...

随机推荐

  1. Keil(MDK-ARM)在线调试(Ⅰ)(转)

    Ⅰ.写在前面 Keil在线调试的内容有很多,本文带来在线调试常用的内容:Debug Toolbar调试工具栏(复位.全速运行.停止运行.单步调试.逐行调试.跳出调试.运行到光标行.跳转到暂停行.调试窗 ...

  2. 编写高性能的 Lua 代码

    前言 Lua是一门以其性能著称的脚本语言,被广泛应用在很多方面,尤其是游戏.像<魔兽世界>的插件,手机游戏<大掌门><神曲><迷失之地>等都是用Lua来 ...

  3. 96、facebook Fresco框架库源使用(转载)

    各个属性详情:http://blog.csdn.net/y1scp/article/details/49245535 开源项目链接 facebook Fresco仓库:git clone https: ...

  4. PHP MySQL Insert Into

    INSERT INTO 语句用于向数据库表中插入新记录. 向数据库表插入数据 INSERT INTO 语句用于向数据库表添加新记录. 语法 INSERT INTO table_name VALUES ...

  5. LeetCode——Search a 2D Matrix II

    Description: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix ...

  6. Android 判断当前是否在跑monkey测试

    /**     * Returns true if Monkey is running.     */    public static boolean isMonkeyRunning() {     ...

  7. JavaWeb温习之防止表单重复提交

    表单重复提交主要有以下三种情况: 1. 在网络延迟的情况下让用户有时间点击多次submit按钮导致表单重复提交 2. 表单提交后用户点击[刷新]按钮导致表单重复提交 3. 用户提交表单后,点击浏览器的 ...

  8. 10.Node.js核心模块

    1.全局对象2.常用工具3.事件机制4.文件系统访问5.HTTP服务与客户端 一.全局对象(Global Object), 与window对象一样 process ==> 全局变量, 描述当前N ...

  9. ios 更改全局UINavigationBar的背景图片以及通知栏颜色

    1.更改UINavigationController push 到另一个界面返回按钮的title self.navigationController.navigationBar.topItem.bac ...

  10. mac必装工具以及mac使用介绍

    必装工具 Scroll Reverserhttp://pilotmoon.com/scrollreverser/:一款可以使得鼠标使用方式和windows系统一致的软件 编程工具 ,,,,, 常用快捷 ...