For \( f(x) \) to be continuous at \( x = 2 \), the left-hand limit (LHL), right-hand limit (RHL), and \( f(2) \) must be equal.
1. Left-hand limit (LHL): For \( x<2 \): \( f(x) = \frac{x - 2}{|x - 2|} + a \). Since \( x<2 \), \( |x - 2| = -(x - 2) \), so \( f(x) = \frac{x - 2}{-(x - 2)} + a = -1 + a \). Thus, as \( x \to 2^- \): \( {LHL} = -1 + a \).
2. Right-hand limit (RHL): For \( x>2 \): \( f(x) = \frac{x - 2}{|x - 2|} + b \). Since \( x>2 \), \( |x - 2| = x - 2 \), so \( f(x) = \frac{x - 2}{x - 2} + b = 1 + b \). Thus, as \( x \to 2^+ \): \( {RHL} = 1 + b \).
3. Value at \( x = 2 \): \( f(2) = a + b \).
4. Continuity condition: For continuity, \( {LHL} = {RHL} = f(2) \). Substituting the expressions: \( -1 + a = 1 + b = a + b \).
Equating \( -1 + a \) and \( a + b \): \( -1 + a = a + b \implies b = -1 \).
Equating \( 1 + b \) and \( a + b \): \( 1 + b = a + b \implies a = 1 \).
Final Answer: \( \boxed{a = 1, b = -1} \)