Skip to content
This repository was archived by the owner on Apr 30, 2018. It is now read-only.

Commit b559372

Browse files
author
Kent C. Dodds
committed
fix(ngModelAttrsManipulator): Remove deprecated code
You used to be able to specify in your property. Now it should be defined in your property. BREAKING CHANGE: If you used before and did not heed the deprecation warning, you're going to want to move it to .
1 parent 4f9d247 commit b559372

File tree

3 files changed

+4
-62
lines changed

3 files changed

+4
-62
lines changed

other/ERRORS_AND_WARNINGS.md

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -127,32 +127,6 @@ of the expression, the scope you're passed wont have all the properties you may
127127
See documentation [here](http://docs.angular-formly.com/docs/field-configuration-object#hideexpression-string--function)
128128
and an example [here](http://angular-formly.com/#/example/field-options/hide-fields)
129129

130-
# skipNgModelAttrsManipulator moved
131-
132-
This property has been moved from the `data` property to the `extras` property.
133-
134-
Before:
135-
136-
```javascript
137-
{
138-
template: '<hr />',
139-
data: {
140-
skipNgModelAttrsManipulator: true
141-
}
142-
}
143-
```
144-
145-
After:
146-
147-
```javascript
148-
{
149-
template: '<hr />',
150-
extras: {
151-
skipNgModelAttrsManipulator: true
152-
}
153-
}
154-
```
155-
156130
# Notes
157131

158132
It is recommended to disable warnings in production using `formlyConfigProvider.disableWarnings = true`. Note: This will

src/run/formlyNgModelAttrsManipulator.js

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {contains} from '../other/utils';
44
export default addFormlyNgModelAttrsManipulator;
55

66
// @ngInject
7-
function addFormlyNgModelAttrsManipulator(formlyConfig, $interpolate, formlyWarn) {
7+
function addFormlyNgModelAttrsManipulator(formlyConfig, $interpolate) {
88
if (formlyConfig.extras.disableNgModelAttrsManipulator) {
99
return;
1010
}
@@ -13,7 +13,7 @@ function addFormlyNgModelAttrsManipulator(formlyConfig, $interpolate, formlyWarn
1313

1414
function ngModelAttrsManipulator(template, options, scope) {
1515
const node = document.createElement('div');
16-
const skip = getSkip(options);
16+
const skip = options.extras && options.extras.skipNgModelAttrsManipulator;
1717
if (skip === true) {
1818
return template;
1919
}
@@ -172,22 +172,6 @@ function addFormlyNgModelAttrsManipulator(formlyConfig, $interpolate, formlyWarn
172172
return div.querySelector(selector);
173173
}
174174

175-
function getSkip(options) {
176-
// UPDATE IN 7.0.0
177-
let skip = options.extras && options.extras.skipNgModelAttrsManipulator;
178-
if (!angular.isDefined(skip)) {
179-
skip = options.data && options.data.skipNgModelAttrsManipulator;
180-
if (angular.isDefined(skip)) {
181-
formlyWarn(
182-
'skipngmodelattrsmanipulator-moved',
183-
'The skipNgModelAttrsManipulator property has been moved from the `data` property to the `extras` property',
184-
options
185-
);
186-
}
187-
}
188-
return skip;
189-
}
190-
191175
function getBuiltInAttributes() {
192176
const ngModelAttributes = {
193177
focus: {

src/run/formlyNgModelAttrsManipulator.test.js

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,13 @@
22
import angular from 'angular';
33
import _ from 'lodash';
44

5-
import testUtils from '../test.utils.js';
6-
7-
const {shouldWarnWithLog} = testUtils;
8-
95
describe('formlyNgModelAttrsManipulator', () => {
106
beforeEach(window.module('formly'));
117

12-
let formlyConfig, manipulator, scope, field, result, resultEl, resultNode, $log;
8+
let formlyConfig, manipulator, scope, field, result, resultEl, resultNode;
139
const template = '<input ng-model="model[options.key]" />';
1410

15-
beforeEach(inject((_formlyConfig_, $rootScope, _$log_) => {
16-
$log = _$log_;
11+
beforeEach(inject((_formlyConfig_, $rootScope) => {
1712
formlyConfig = _formlyConfig_;
1813
manipulator = formlyConfig.templateManipulators.preWrapper[0];
1914
scope = $rootScope.$new();
@@ -27,17 +22,6 @@ describe('formlyNgModelAttrsManipulator', () => {
2722
}));
2823

2924
describe(`skipping`, () => {
30-
it(`should give a deprecation warning when using the data property`, () => {
31-
field.data.skipNgModelAttrsManipulator = true;
32-
const logArgs = [
33-
'Formly Warning:',
34-
'The skipNgModelAttrsManipulator property has been moved from the `data` property to the `extras` property',
35-
field,
36-
/skipngmodelattrsmanipulator-moved/
37-
];
38-
shouldWarnWithLog($log, logArgs, manipulate);
39-
});
40-
4125

4226
it(`should allow you to skip the manipulator wholesale for the field`, () => {
4327
field.extras.skipNgModelAttrsManipulator = true;

0 commit comments

Comments
 (0)