File tree 4 files changed +44
-1
lines changed
4 files changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ <h2>Things To Do ;-)</h2>
24
24
< ul class ="well unstyled ">
25
25
< li ng-repeat ="item in todo.items " ng-class ="todo.classFor(item) ">
26
26
< label class ="checkbox ">
27
- < input type ="checkbox " ng-model ="item.done "> {{item.text}}
27
+ < input type ="checkbox " ng-model ="item.done "> {{item.text}} < todo-type symbol =" ? " > </ todo-type >
28
28
</ label >
29
29
</ li >
30
30
</ ul >
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ main() {
10
10
print (window.location.search);
11
11
var module = new Module ()
12
12
..type (TodoController )
13
+ ..type (NgPseudo )
14
+ ..type (TypeComponent )
13
15
..type (PlaybackHttpBackendConfig );
14
16
15
17
// If these is a query in the URL, use the server-backed
Original file line number Diff line number Diff line change 47
47
padding-top : 10px ;
48
48
padding-bottom : 10px ;
49
49
}
50
+
51
+ li : hover todo-type ::x-text {
52
+ font-weight : bold;
53
+ }
Original file line number Diff line number Diff line change 1
1
library todo;
2
2
3
3
import 'package:angular/angular.dart' ;
4
+ import 'dart:html' as dom;
4
5
5
6
class Item {
6
7
String text;
@@ -91,3 +92,39 @@ class TodoController {
91
92
return items.where ((item) => ! item.done).length;
92
93
}
93
94
}
95
+
96
+ @NgDirective (
97
+ selector: '[ng-pseudo]' ,
98
+ map: const { 'ng-pseudo' : '@name' }
99
+ )
100
+ class NgPseudo {
101
+ dom.Element _elt;
102
+ set name (n) {
103
+ _elt.pseudo = n;
104
+ }
105
+
106
+ NgPseudo (dom.Element this ._elt);
107
+ }
108
+
109
+
110
+ @NgComponent (
111
+ selector: 'todo-type' ,
112
+ map: const {
113
+ 'symbol' : '@symbol'
114
+ },
115
+ template: """<span style=\' border:1px solid black; padding: 0.1em\' >
116
+ [<span ng-bind="ctrl.symbol" ng-pseudo="x-text" ng-click="ctrl.rotSymbol()"></span>]
117
+ </span>""" ,
118
+ publishAs: 'ctrl'
119
+ )
120
+ class TypeComponent {
121
+ String symbol;
122
+ rotSymbol () {
123
+ switch (symbol) {
124
+ case '?' : return symbol = '!' ;
125
+ case '!' : return symbol = '#' ;
126
+ case '#' : return symbol = '*' ;
127
+ case '*' : return symbol = '?' ;
128
+ }
129
+ }
130
+ }
You can’t perform that action at this time.
0 commit comments