@Test public void replacesIndexBindingWithFunctionParamater() throws Exception { assertThat(replaceIndexBindingWithFunctionParameter("{{$index}}", 0)) .isEqualTo("`${rowIndex0}`"); assertThat( replaceIndexBindingWithFunctionParameter("In the {{$index}} middle", 1)) .isEqualTo("`In the ${rowIndex1} middle`"); assertThat( replaceIndexBindingWithFunctionParameter("{{$index}} starts with", 1)) .isEqualTo("`${rowIndex1} starts with`"); assertThat( replaceIndexBindingWithFunctionParameter("ends with {{$index}}", 1)) .isEqualTo("`ends with ${rowIndex1}`"); assertThat(replaceIndexBindingWithFunctionParameter("no expression", 1)) .isEqualTo("no expression"); }
public static String replaceIndexBindingWithFunctionParameter(String text, int repeaterCount) { if (text.contains("{{$index}}")) { return "`" + text.replaceAll("\\{\\{\\$index\\}\\}", "\\${rowIndex" + repeaterCount + "}") + "`"; } else { return text; } }
Expressions { public static String replaceIndexBindingWithFunctionParameter(String text, int repeaterCount) { if (text.contains("{{$index}}")) { return "`" + text.replaceAll("\\{\\{\\$index\\}\\}", "\\${rowIndex" + repeaterCount + "}") + "`"; } else { return text; } } }
Expressions { public static String replaceIndexBindingWithFunctionParameter(String text, int repeaterCount) { if (text.contains("{{$index}}")) { return "`" + text.replaceAll("\\{\\{\\$index\\}\\}", "\\${rowIndex" + repeaterCount + "}") + "`"; } else { return text; } }  }
Expressions { public static String replaceIndexBindingWithFunctionParameter(String text, int repeaterCount) { if (text.contains("{{$index}}")) { return "`" + text.replaceAll("\\{\\{\\$index\\}\\}", "\\${rowIndex" + repeaterCount + "}") + "`"; } else { return text; } }  static String getFirstExpression(String text); static boolean hasExpression(String text); static int getExpressionCount(String text); static String extractNameFromRepeater(String repeaterExpression); static String extractExactRepeater(String repeaterExpression); static String extractNameFromNgFor(String ngForExpression); static String replaceIndexBindingWithFunctionParameter(String text,
			int repeaterCount); static String extractControllerAs(String controllerExpression); }
Expressions { public static String replaceIndexBindingWithFunctionParameter(String text, int repeaterCount) { if (text.contains("{{$index}}")) { return "`" + text.replaceAll("\\{\\{\\$index\\}\\}", "\\${rowIndex" + repeaterCount + "}") + "`"; } else { return text; } }  static String getFirstExpression(String text); static boolean hasExpression(String text); static int getExpressionCount(String text); static String extractNameFromRepeater(String repeaterExpression); static String extractExactRepeater(String repeaterExpression); static String extractNameFromNgFor(String ngForExpression); static String replaceIndexBindingWithFunctionParameter(String text,
			int repeaterCount); static String extractControllerAs(String controllerExpression);  }