Skip to content

Commit 7ce48f7

Browse files
author
Kent C. Dodds
committed
pushing 3.3.0
1 parent 699e72c commit 7ce48f7

19 files changed

+938
-129
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# 3.3.0
2+
3+
## New Features
4+
5+
- `api-check` is now a dependency of angular-formly. It is bundled with `angular-formly` to prevent a breaking change and `angular-formly` exposes it as an injectable constant via `apiCheck`.
6+
- `formlyConfig.setType` now allows you to specify `validateOptions` which will pass the user's specified options for validation. The author is responsible for logging warnings or throwing errors. Recommended to use `apiCheck.js` which will be shipped as a dependency for `angular-formly` soon. This also supports `extends`.
7+
8+
## Other Changes
9+
10+
- `formly-form` no longer throwing an error when the `scope.model` is falsey.
11+
- `formlyConfig.setType` no longer throws an error when you neglect to specify a `template`, `templateUrl`, or `defaultOptions` because with `extends` you could create a type that's meant to be extended.
12+
113
# 3.2.7
214

315
## Bug Fixes

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,12 +513,33 @@ Specify the name of wrappers that you want fields of this type to be wrapped in
513513

514514
This function will be invoked (using the `$controller` service) at the end of the `formly-field` controller (before the
515515
field's `controller` if specified). It can inject anything in the `$injector` as well as the `$scope` of the
516-
`formly-field`. If it is a string, it must be the name of a controller that has been registered with angular.
516+
`formly-field`. If it is a string, it must be the name of a controller that has been registered with angular. If this
517+
type extends another, this function will be run *after* the parent controller function is run.
517518

518519
#### link (function)
519520

520521
This function will be invoked after the `formly-field` link function has been invoked (before the field's `link` if
521-
specified). It is invoked with all the normal arguments of a regular link function.
522+
specified). It is invoked with all the normal arguments of a regular link function. If the type extends another, this
523+
function will be run *after* the parent link function is run.
524+
525+
#### validateOptions (function)
526+
527+
This function will be invoked with the options of the field after it has been merged with it's `optionsDefaults` and
528+
any types that its type `extends`. Feel free to log warnings to the console or throw errors here to help users use your
529+
types correctly. Recommended: Use [apiCheck.js](https://github.com/kentcdodds/apiCheck.js) as this is what formly uses
530+
and will already be available to you. You can inject this dependency with `apiCheck`. You can use it like so:
531+
532+
```javascript
533+
ngModule.run(function(formlyConfig, apiCheck) {
534+
formlyConfig.setType({
535+
name: 'input',
536+
template: '<input ng-model="model[options.key]" />',
537+
validateOptions: function(options) {
538+
apiCheck.throw(apiCheck.object, arguments);
539+
}
540+
});
541+
});
542+
```
522543

523544
### setWrapper, getWrapper, getWrapperByType, removeWrapperByName, & removeWrappersForType
524545

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-formly",
3-
"version": "3.2.7",
3+
"version": "3.3.0",
44
"authors": [
55
"Astrism <[email protected]>"
66
],

demo/bundle.js

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
"highlight.js": "^8.4.0"
3434
},
3535
"devDependencies": {
36-
"6to5": "^2.13.7",
37-
"6to5-loader": "^2.0.0",
3836
"angular-animate": "^1.3.11",
37+
"babel-core": "^4.4.6",
38+
"babel-loader": "^4.0.0",
3939
"css-loader": "^0.9.1",
4040
"deep-extend": "^0.3.2",
4141
"file-loader": "^0.8.1",

demo/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function getConfig(context) {
6262
{test: /\.css$/, loader: 'style!css'},
6363
{test: /\.html$/, loader: 'raw', exclude: /node_modules/},
6464
{test: /\.json$/, loader: 'json'},
65-
{test: /\.js$/, loader: (dev ? '' : ngAnnotateLoader + '!') + '6to5!jshint', exclude: /node_modules|dist/},
65+
{test: /\.js$/, loader: (dev ? '' : ngAnnotateLoader + '!') + 'babel!jshint', exclude: /node_modules|dist/},
6666
{test: /\.(woff|woff2|ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'file-loader?name=res/[name].[ext]?[hash]'}
6767
]
6868
}

0 commit comments

Comments
 (0)