forked from muicss/mui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform.js
More file actions
36 lines (28 loc) · 792 Bytes
/
form.js
File metadata and controls
36 lines (28 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* MUI Angular Form Directive
* @module angular/form
*/
import angular from 'angular';
const moduleName = 'mui.form';
angular.module(moduleName, [])
.directive('muiForm', function() {
return {
restrict: 'AE',
template: '<form class="mui-form"></form>',
transclude: true,
scope: true,
replace: true,
link: function(scope, element, attrs, controller, transcludeFn) {
// use transcludeFn to pass ng-controller on parent element
transcludeFn(scope, function(clone) {
element.append(clone);
});
// handle inline forms
if (!angular.isUndefined(attrs.inline)) {
element.addClass('mui-form--inline');
}
}
};
});
/** Define module API */
export default moduleName;