Splits template into angular directive