博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[Angular 2] Exposing component properties to the template
阅读量:4704 次
发布时间:2019-06-09

本文共 1145 字,大约阅读时间需要 3 分钟。

Showing you how you can expose properties on your Controller to access them using #refs inside of your template.

 

// letterSelect.tsimport {Component, View, FORM_DIRECTIVES, NgFor} from 'angular2/angular2';@Component({    selector: 'letter-select'})@View({    directives: [NgFor,FORM_DIRECTIVES],    template: `            `})export class LetterSelect {    letters: string[] = ['e', 's', 'w'];    selectedLetter: string = 'e';    constructor() {    }}

 

todoList.ts

import {Component, View, NgFor, FORM_DIRECTIVES} from 'angular2/angular2';import {TodoService} from './todoService';import {TodoItemRender} from './todoItemRender';import {StartsWith} from './startsWith';import {LetterSelect} from './letterSelect';@Component({    selector: 'todo-list'})@View({    pipes: [StartsWith],    directives: [NgFor, TodoItemRender, FORM_DIRECTIVES, LetterSelect],    template: `          
`})export class TodoList{ constructor( public todoService:TodoService ){ }}

 

转载于:https://www.cnblogs.com/Answer1215/p/4926643.html

你可能感兴趣的文章
【小程序云开发入门】quickStart
查看>>
分布式一致性协议-2PC与3PC(二)
查看>>
SCP-bzoj-1079
查看>>
Python 实践项目 游戏
查看>>
AJAX--Jquery
查看>>
模拟新浪微博随便看看
查看>>
环境搭建
查看>>
解密EXL
查看>>
简易版cnlog
查看>>
erlang程序运行的几种方式
查看>>
堆heap和栈Stack(百科)
查看>>
html5页面实现点击复制功能
查看>>
633. 寻找重复的数
查看>>
沉淀,再出发:python中的pandas包
查看>>
Rule 12: Remove Duplicate Scripts(Chapter 12 of High performance Web Sites)
查看>>
操作redis数据库 & 操作Excel & 开发接口
查看>>
framework7 点取消后还提交表单解决方案
查看>>
JAVA Axis2调用WebService
查看>>
js学习---常用的内置对象(API)小结 :
查看>>
付费版百度指数 就是这么坑爹
查看>>