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

Commit fcd636a

Browse files
committed
build and bumped to 0.0.11
1 parent 2742d5d commit fcd636a

File tree

5 files changed

+39
-42
lines changed

5 files changed

+39
-42
lines changed

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": "0.0.10",
3+
"version": "0.0.11",
44
"authors": [
55
"Grant Helton <[email protected]>"
66
],

dist/formly.js

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,8 @@ angular.module('formly.render').directive('formlyField', [
77
'$http',
88
'$compile',
99
'$templateCache',
10-
function formlyField($http, $compile, $templateCache) {
11-
var getTemplateUrl = function (type) {
12-
var templateUrl = '';
13-
switch (type) {
14-
case 'textarea':
15-
templateUrl = 'directives/formly-field-textarea.html';
16-
break;
17-
case 'radio':
18-
templateUrl = 'directives/formly-field-radio.html';
19-
break;
20-
case 'select':
21-
templateUrl = 'directives/formly-field-select.html';
22-
break;
23-
case 'number':
24-
templateUrl = 'directives/formly-field-number.html';
25-
break;
26-
case 'checkbox':
27-
templateUrl = 'directives/formly-field-checkbox.html';
28-
break;
29-
case 'password':
30-
templateUrl = 'directives/formly-field-password.html';
31-
break;
32-
case 'hidden':
33-
templateUrl = 'directives/formly-field-hidden.html';
34-
break;
35-
case 'email':
36-
templateUrl = 'directives/formly-field-email.html';
37-
break;
38-
case 'text':
39-
templateUrl = 'directives/formly-field-text.html';
40-
break;
41-
default:
42-
templateUrl = null;
43-
break;
44-
}
45-
return templateUrl;
46-
};
10+
'formlyTemplate',
11+
function formlyField($http, $compile, $templateCache, formlyTemplate) {
4712
return {
4813
restrict: 'AE',
4914
transclude: true,
@@ -58,7 +23,7 @@ angular.module('formly.render').directive('formlyField', [
5823
if (template) {
5924
setElementTemplate(template);
6025
} else {
61-
var templateUrl = $scope.options.templateUrl || getTemplateUrl($scope.options.type);
26+
var templateUrl = $scope.options.templateUrl || formlyTemplate.getTemplateUrl($scope.options.type);
6227
if (templateUrl) {
6328
$http.get(templateUrl, { cache: $templateCache }).then(function (response) {
6429
setElementTemplate(response.data);
@@ -132,6 +97,38 @@ angular.module('formly.render').directive('formlyForm', function formlyForm() {
13297
]
13398
};
13499
});
100+
'use strict';
101+
angular.module('formly.render').provider('formlyTemplate', function () {
102+
var templateMap = {
103+
textarea: 'directives/formly-field-textarea.html',
104+
radio: 'directives/formly-field-radio.html',
105+
select: 'directives/formly-field-select.html',
106+
number: 'directives/formly-field-number.html',
107+
checkbox: 'directives/formly-field-checkbox.html',
108+
password: 'directives/formly-field-password.html',
109+
hidden: 'directives/formly-field-hidden.html',
110+
email: 'directives/formly-field-email.html',
111+
text: 'directives/formly-field-text.html'
112+
};
113+
function setTemplateUrl(name, templateUrl) {
114+
if (typeof name === 'string') {
115+
templateMap[name] = templateUrl;
116+
} else {
117+
angular.forEach(name, function (templateUrl, name) {
118+
setTemplateUrl(name, templateUrl);
119+
});
120+
}
121+
}
122+
function getTemplateUrl(type) {
123+
return templateMap[type];
124+
}
125+
;
126+
this.setTemplateUrl = setTemplateUrl;
127+
this.getTemplateUrl = getTemplateUrl;
128+
this.$get = function formlyTemplate() {
129+
return this;
130+
};
131+
});
135132
angular.module('formly.render').run([
136133
'$templateCache',
137134
function ($templateCache) {

dist/formly.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/formly.min.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.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": "0.0.1",
3+
"version": "0.0.11",
44
"build": 0,
55
"devDependencies": {
66
"grunt-gh-pages": "~0.9.0",

0 commit comments

Comments
 (0)