Refactor class assignment on alert directive.