var $ele = $('#container');
$ele.on('click', function (e){
var $t = $(e.target);
if($t.is('.file')){
openDoc($t);
}
if($t.is('.nav a')){
changeViewTo($t.attr('index'));
}
})
function openDoc(){
$ele......
}
function changeViewTo(){
$ele......
}
How is the above code distributed in directive
or controller
or service
? openDoc
and changeViewTo
both operate on $ele
and its child elements
Requirements:
1. The openDoc
and changeViewTo
methods need to be exposed to the outside world.