foldable angularjs directive working properly