refactor to directive
change readme
config karma
fix directive code bug and implement tests
update readme