一、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. Oracle中给用户赋予debug权限

    通过可视化工具(如PL/SQL Developer.Oracle SQL Developer)调试Oracle的存储过程时,如果遇到如下错误信息:...ORA-01031: insufficient ...

  2. Tcp/ip实验准备:一个简单的定时器——boost实现

    tcp/ip实验须要在指定的时间查看结果,为了实验方便,做了一个定时器.用法是: 在命令行输入:timer 输入数字之后,计时对应秒数 输入m数字之后.计时对应分钟数(支持小数分钟数) 输入q退出. ...

  3. swift -- 计步器CMPedometer的使用

    最近公司接了个项目,是一款运动类型的APP,可以检测运动量(例如:步数,上下楼等).睡眠信息.速度等信息,因为以前粗略的了解过传感器方面的相关信息,知道主要是苹果设备内置的传感器在起作用,传感器的种类 ...

  4. shell基础篇(九)函数

    函数可以让我们将一个复杂功能划分成若干模块,让程序结构更加清晰,代码重复利用率更高.像其他编程语言一样,Shell 也支持函数.Shell 函数必须先定义后使用1. Shell 函数的定义格式如下: ...

  5. Dubbo(二) -- Simple Monitor

    一.简介 dubbo-monitor-simple是dubbo提供的简单监控中心,可以用来显示接口暴露,注册情况,也可以看接口的调用明细,调用时间等. Simple Monitor挂掉不会影响到Con ...

  6. IntersectRect、wcsrchr、CComPtr、GetFileAttributes

    IntersectRect    两矩形相交形成的新矩形 The IntersectRect function calculates the intersection of two source re ...

  7. Anfroid 在界面中显示图片 ImageView

    ImageView1.什么是ImageView是显示图片的一个控件2.ImageView属性android:src ImageView的内容颜色 android:background ImageVie ...

  8. PostgreSQL数据库smallint、bigint转到Oracle,要用什么类型替代? 是number么,那长度分别是多少?

    个人意见,仅供参考:smallint是有符号或无符号2字节的整数,范围是0-65,536,5位整数bigint是有符号或无符号8字节的整数,范围是0-18,446,744,073,709,551,61 ...

  9. 在 CSS 中使用特征查询

    原文地址:Using Feature Queries in CSS 原文作者:Jen Simmons 译文出自:掘金翻译计划 本文永久链接:github.com/xitu/gold-m… 译者:Che ...

  10. LeetCode——Rectangle Area

    Description:https://leetcode.com/problems/rectangle-area/ public class Solution { public int compute ...