refactor controller and directive and fixed view1