@@ -11,7 +11,7 @@ angular.module('schemaForm').directive('sfField',
1111 scope : true ,
1212 require : '?^sfSchema' ,
1313 link : {
14- pre : function ( scope , element , attrs , sfSchema ) {
14+ pre : function ( scope ) {
1515 //The ngModelController is used in some templates and
1616 //is needed for error messages,
1717 scope . $on ( 'schemaFormPropagateNgModelController' , function ( event , ngModel ) {
@@ -140,64 +140,12 @@ angular.module('schemaForm').directive('sfField',
140140 // Rebind our part of the form to the scope.
141141 var once = scope . $watch ( attrs . sfField , function ( form ) {
142142 if ( form ) {
143- console . warn ( 'got form!!!!' , form )
144143 // Workaround for 'updateOn' error from ngModelOptions
145144 // see https://github.com/Textalk/angular-schema-form/issues/255
146145 // and https://github.com/Textalk/angular-schema-form/issues/206
147146 form . ngModelOptions = form . ngModelOptions || { } ;
148147 scope . form = form ;
149148
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- //});
201149
202150 // Where there is a key there is probably a ngModel
203151 if ( form . key ) {
0 commit comments