Showing how can expose properties on your controllers to access them using #refs inside of your template.
// letterselect.ts ' angular2/angular2 '; @Component ({ ' letter-select '}) @View ({ directives: [Ngfor,form _directives], Template: ' <select [(Ng-model)]= "Selectedletter" > <option *ng-for = "#letter of letters" >{{letter}}</option> </select> '}) Export class Letterselect { = [' E ', ' s ', ' W ']; Selectedletter = ' 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: ` <div> <todo-item-Render*ng- for= "#todo of Todoservice.todos | StartsWith: ' title ':Letterselect.Selectedletter"[Todoinput]= "Todo" > </todo-item-render><letter-select #letter-select></letter-select></div> `}) Export class todolist{Constructor (public todoservice:todoservice) {}}
[Angular 2] Exposing component properties to the template