Refactor cardView directive.