Refactor directive

some do not belong to .forEach function

and

attrs.$observe should check in $timeout