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

Commit b63438a

Browse files
author
Kamil Kisiela
committed
Add slider field with min,max, step and discrete options
1 parent 907213c commit b63438a

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

lib/client/types/slider/slider.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
var {SetModule} = angular2now;
2+
3+
SetModule('formlyMaterial')
4+
.config((formlyConfigProvider, formlyMaterialProvider) => {
5+
6+
formlyConfigProvider.setType({
7+
name: 'slider',
8+
templateUrl: formlyMaterialProvider.templateUrl('lib/client/types/slider/slider.ng.html'),
9+
defaultOptions: {
10+
ngModelAttrs: {
11+
min: {
12+
bound: 'min',
13+
attribute: 'min'
14+
},
15+
max: {
16+
bound: 'max',
17+
attribute: 'max'
18+
},
19+
step: {
20+
bound: 'step',
21+
attribute: 'step'
22+
},
23+
discrete: {
24+
bound: 'md-discrete'
25+
}
26+
}
27+
},
28+
apiCheck: (check) => ({
29+
templateOptions: {
30+
min: check.number.optional,
31+
max: check.number.optional,
32+
step: check.number.optional,
33+
discrete: check.bool.optional
34+
}
35+
})
36+
});
37+
38+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<md-slider ng-model="model[options.key]"></md-slider>

package.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ Package.onUse(function (api) {
9292

9393
// chips
9494
'lib/client/types/chips/chips.js',
95-
'lib/client/types/chips/chips.ng.html'
95+
'lib/client/types/chips/chips.ng.html',
96+
97+
// slider
98+
'lib/client/types/slider/slider.js',
99+
'lib/client/types/slider/slider.ng.html'
96100

97101
], client);
98102

0 commit comments

Comments
 (0)