This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Commit f91637b
committed
fix(ngModelOptions): preserve context of getter/setters
Many thanks to @NevilleS and @jbedard for collaborating with me on a solution to this!
Closes #9394
Closes #9865
BREAKING CHANGE: previously, ngModel invoked getter/setters in the global context.
For example:
```js
<input ng-model="model.value" ng-model-options="{ getterSetter: true }">
```
would previously invoke `model.value()` in the global context.
Now, ngModel invokes `value` with `model` as the context.
It's unlikely that real apps relied on this behavior. If they did they can use `.bind` to explicilty
bind a getter/getter to the global context, or just reference globals normally without `this`.1 parent e3764e3 commit f91637b
2 files changed
+61
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1740 | 1740 | | |
1741 | 1741 | | |
1742 | 1742 | | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
1743 | 1746 | | |
1744 | 1747 | | |
1745 | 1748 | | |
1746 | | - | |
1747 | | - | |
1748 | | - | |
1749 | | - | |
1750 | | - | |
1751 | | - | |
1752 | | - | |
1753 | | - | |
1754 | | - | |
1755 | | - | |
1756 | | - | |
1757 | | - | |
1758 | | - | |
1759 | | - | |
1760 | | - | |
1761 | | - | |
1762 | | - | |
1763 | | - | |
1764 | | - | |
1765 | 1749 | | |
1766 | 1750 | | |
1767 | | - | |
1768 | | - | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
1769 | 1770 | | |
1770 | 1771 | | |
1771 | 1772 | | |
| |||
2164 | 2165 | | |
2165 | 2166 | | |
2166 | 2167 | | |
2167 | | - | |
| 2168 | + | |
2168 | 2169 | | |
2169 | 2170 | | |
2170 | 2171 | | |
| |||
2192 | 2193 | | |
2193 | 2194 | | |
2194 | 2195 | | |
2195 | | - | |
| 2196 | + | |
2196 | 2197 | | |
2197 | 2198 | | |
2198 | 2199 | | |
| |||
2288 | 2289 | | |
2289 | 2290 | | |
2290 | 2291 | | |
2291 | | - | |
| 2292 | + | |
2292 | 2293 | | |
2293 | 2294 | | |
2294 | 2295 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2059 | 2059 | | |
2060 | 2060 | | |
2061 | 2061 | | |
2062 | | - | |
| 2062 | + | |
2063 | 2063 | | |
2064 | 2064 | | |
2065 | 2065 | | |
| |||
2074 | 2074 | | |
2075 | 2075 | | |
2076 | 2076 | | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
2077 | 2083 | | |
2078 | 2084 | | |
2079 | 2085 | | |
| |||
2093 | 2099 | | |
2094 | 2100 | | |
2095 | 2101 | | |
| 2102 | + | |
| 2103 | + | |
| 2104 | + | |
| 2105 | + | |
| 2106 | + | |
| 2107 | + | |
| 2108 | + | |
| 2109 | + | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
2096 | 2131 | | |
2097 | 2132 | | |
2098 | 2133 | | |
| |||
0 commit comments