Commit bb4d3b7
committed
fix(ngModelOptions): preserve context of getter/setters
Many thanks to @NevilleS and @jbedard for collaborating with me on a solution to this!
Closes angular#9394
Closes angular#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 6dbd606 commit bb4d3b7
2 files changed
+61
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1751 | 1751 | | |
1752 | 1752 | | |
1753 | 1753 | | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
1754 | 1757 | | |
1755 | 1758 | | |
1756 | 1759 | | |
1757 | | - | |
1758 | | - | |
1759 | | - | |
1760 | | - | |
1761 | | - | |
1762 | | - | |
1763 | | - | |
1764 | | - | |
1765 | | - | |
1766 | | - | |
1767 | | - | |
1768 | | - | |
1769 | | - | |
1770 | | - | |
1771 | | - | |
1772 | | - | |
1773 | | - | |
1774 | | - | |
1775 | | - | |
1776 | 1760 | | |
1777 | 1761 | | |
1778 | | - | |
1779 | | - | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
1780 | 1781 | | |
1781 | 1782 | | |
1782 | 1783 | | |
| |||
2189 | 2190 | | |
2190 | 2191 | | |
2191 | 2192 | | |
2192 | | - | |
| 2193 | + | |
2193 | 2194 | | |
2194 | 2195 | | |
2195 | 2196 | | |
| |||
2217 | 2218 | | |
2218 | 2219 | | |
2219 | 2220 | | |
2220 | | - | |
| 2221 | + | |
2221 | 2222 | | |
2222 | 2223 | | |
2223 | 2224 | | |
| |||
2313 | 2314 | | |
2314 | 2315 | | |
2315 | 2316 | | |
2316 | | - | |
| 2317 | + | |
2317 | 2318 | | |
2318 | 2319 | | |
2319 | 2320 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2102 | 2102 | | |
2103 | 2103 | | |
2104 | 2104 | | |
2105 | | - | |
| 2105 | + | |
2106 | 2106 | | |
2107 | 2107 | | |
2108 | 2108 | | |
| |||
2117 | 2117 | | |
2118 | 2118 | | |
2119 | 2119 | | |
| 2120 | + | |
| 2121 | + | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
2120 | 2126 | | |
2121 | 2127 | | |
2122 | 2128 | | |
| |||
2136 | 2142 | | |
2137 | 2143 | | |
2138 | 2144 | | |
| 2145 | + | |
| 2146 | + | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
2139 | 2174 | | |
2140 | 2175 | | |
2141 | 2176 | | |
| |||
0 commit comments