Many Components require different styles based on a set of conditions. Angular 2 helps you style your Components by allows you to define Styles inline, then choosing which styles to use based on the current values in your Controller.

import {Component, Input} from 'angular2/core';
@Component({
selector: 'todo-item-renderer',
template: `
<style>
.completed{
text-decoration: line-through;
}
</style>
<div>
<span [ngClass]="todo.status"
[contentEditable]="todo.isEdit">{{todo.title}}</span>
<button (click)="todo.toggle()">Toggle</button>
<button (click)="todo.edit()">Edit</button>
</div>
`
}) export class TodoItemRenderer{
@Input() todo
}

最新文章

  1. React 还是 Vue: 你应该选择哪一个Web前端框架?
  2. Lab_6_SysOps_AutoScaling_Linux_v2.5
  3. Javascript之旅——第三站:几个需要注意的运算符
  4. stm32cube--通用定时器--输入捕获
  5. 使用ODP.NET一次执行多句SQL语句
  6. js 后台弹窗
  7. Nginx系列~概念与windows下环境搭建
  8. SQL SERVER数据库服务操作
  9. window.name 跨域
  10. php获取server端mac和clientmac的地址
  11. CF908G Original Order
  12. PM2 Quick Start
  13. ELK 架构之 Elasticsearch 和 Kibana 安装配置
  14. redist命令操作(二)--哈希Hash,列表List
  15. day6.python字典练习题
  16. Python数据分析实例操作
  17. 20165215 学习基础和c语言基础调查
  18. 8Q - 献给杭电五十周年校庆的礼物
  19. iptables命令(备忘)
  20. JS常用时间处理方法

热门文章

  1. vs2012加载EntityFrameWork框架,连接Oracel
  2. maven发布时在不同的环境使用不同的配置文件
  3. iOS中忽略NSLog打印信息(通过PCH文件中定义DEBUG宏解决)
  4. jQuery旋转插件
  5. Jsp通过JDBC连接到SQL Server2008数据库遇到的几个问题
  6. IO流文件字符输入输出流,缓冲流
  7. Redis+PHP扩展的安装和Redis集群的配置 与 PHP负载均衡开发方案
  8. phpcms二次开发步骤
  9. Java泛型的基本应用
  10. adb :unknown host service