@@ -11,7 +11,7 @@ angular.module('schemaForm').directive('sfField',
11
11
scope : true ,
12
12
require : '?^sfSchema' ,
13
13
link : {
14
- pre : function ( scope , element , attrs , sfSchema ) {
14
+ pre : function ( scope ) {
15
15
//The ngModelController is used in some templates and
16
16
//is needed for error messages,
17
17
scope . $on ( 'schemaFormPropagateNgModelController' , function ( event , ngModel ) {
@@ -140,64 +140,12 @@ angular.module('schemaForm').directive('sfField',
140
140
// Rebind our part of the form to the scope.
141
141
var once = scope . $watch ( attrs . sfField , function ( form ) {
142
142
if ( form ) {
143
- console . warn ( 'got form!!!!' , form )
144
143
// Workaround for 'updateOn' error from ngModelOptions
145
144
// see https://github.com/Textalk/angular-schema-form/issues/255
146
145
// and https://github.com/Textalk/angular-schema-form/issues/206
147
146
form . ngModelOptions = form . ngModelOptions || { } ;
148
147
scope . form = form ;
149
148
150
- /*
151
- //ok let's replace that template!
152
- //We do this manually since we need to bind ng-model properly and also
153
- //for fieldsets to recurse properly.
154
- var templatePromise;
155
-
156
- // type: "template" is a special case. It can contain a template inline or an url.
157
- // otherwise we find out the url to the template and load them.
158
- if (form.type === 'template' && form.template) {
159
- templatePromise = $q.when(form.template);
160
- } else {
161
- var url = form.type === 'template' ? form.templateUrl : templateUrl(name, form);
162
- templatePromise = $http.get(url, {cache: $templateCache}).then(function(res) {
163
- return res.data;
164
- });
165
- }
166
- */
167
- /*
168
- templatePromise.then(function(template) {
169
- if (form.key) {
170
- var key = form.key ?
171
- sfPathProvider.stringify(form.key).replace(/"/g, '"') : '';
172
- template = template.replace(
173
- /\$\$value\$\$/g,
174
- 'model' + (key[0] !== '[' ? '.' : '') + key
175
- );
176
- }
177
- element.html(template);
178
- */
179
- // Do we have a condition? Then we slap on an ng-if on all children,
180
- // but be nice to existing ng-if.
181
- /*if (form.condition) {
182
-
183
- var evalExpr = 'evalExpr(form.condition,{ model: model, "arrayIndex": arrayIndex})';
184
- if (form.key) {
185
- evalExpr = 'evalExpr(form.condition,{ model: model, "arrayIndex": arrayIndex, "modelValue": model' + sfPath.stringify(form.key) + '})';
186
- }
187
-
188
- angular.forEach(element.children(), function(child) {
189
- var ngIf = child.getAttribute('ng-if');
190
- child.setAttribute(
191
- 'ng-if',
192
- ngIf ?
193
- '(' + ngIf +
194
- ') || (' + evalExpr +')'
195
- : evalExpr
196
- );
197
- });
198
- }*/
199
- //$compile(element.contents())(scope);
200
- //});
201
149
202
150
// Where there is a key there is probably a ngModel
203
151
if ( form . key ) {
0 commit comments