Refactored the badge creation into a separate directive for re-use