Commit 500a7d48 authored by Christoph Burgdorf's avatar Christoph Burgdorf

- figured out how to apply classes conditionally

- edit on doubleclick
parent 55f09a27
......@@ -21,7 +21,7 @@
<input id="toggle-all" type="checkbox">
<label for="toggle-all">Mark all as complete</label>
<ul id="todo-list">
<li ng:repeat="todo in todos" ng:click="editTodo(todo)" ng:class="'editing-' + todo.editing + ' done-' + todo.done">
<li ng:repeat="todo in todos" my:dblclick="editTodo(todo)" ng:class="(todo.done && ' done ') + (todo.editing && ' editing ')">
<div class="view">
<input class="toggle" type="checkbox" name="todo.done">
<label>{{ todo.content }}</label>
......
......@@ -10,6 +10,17 @@ angular.directive('my:blur', function(expression, compiledElement) {
};
});
angular.directive('my:dblclick', function(expression, compiledElement) {
var compiler = this;
return function(linkElement) {
var scope = this;
linkElement.bind('dblclick', function(event) {
scope.$apply(expression, linkElement);
event.stopPropagation();
});
};
});
angular.directive("my:focus", function(expression, compiledElement){
return function(element){
this.$watch(expression, function(){
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment