@@ -564,7 +564,6 @@ angular.module('schemaForm').provider('schemaFormDecorators',
564
564
var type = ( form . schema && form . schema . type ) || '' ;
565
565
566
566
// Empty means '',{} and [] for appropriate types and undefined for the rest
567
- //console.log('destroy', destroyStrategy, form.key, type, obj);
568
567
if ( destroyStrategy === 'empty' && type . indexOf ( 'string' ) !== - 1 ) {
569
568
obj [ form . key . slice ( - 1 ) ] = '' ;
570
569
} else if ( destroyStrategy === 'empty' && type . indexOf ( 'object' ) !== - 1 ) {
@@ -1727,7 +1726,7 @@ angular.module('schemaForm').directive('sfField',
1727
1726
scope : true ,
1728
1727
require : '?^sfSchema' ,
1729
1728
link : {
1730
- pre : function ( scope , element , attrs , sfSchema ) {
1729
+ pre : function ( scope ) {
1731
1730
//The ngModelController is used in some templates and
1732
1731
//is needed for error messages,
1733
1732
scope . $on ( 'schemaFormPropagateNgModelController' , function ( event , ngModel ) {
@@ -1856,64 +1855,12 @@ angular.module('schemaForm').directive('sfField',
1856
1855
// Rebind our part of the form to the scope.
1857
1856
var once = scope . $watch ( attrs . sfField , function ( form ) {
1858
1857
if ( form ) {
1859
- console . warn ( 'got form!!!!' , form )
1860
1858
// Workaround for 'updateOn' error from ngModelOptions
1861
1859
// see https://github.com/Textalk/angular-schema-form/issues/255
1862
1860
// and https://github.com/Textalk/angular-schema-form/issues/206
1863
1861
form . ngModelOptions = form . ngModelOptions || { } ;
1864
1862
scope . form = form ;
1865
1863
1866
- /*
1867
- //ok let's replace that template!
1868
- //We do this manually since we need to bind ng-model properly and also
1869
- //for fieldsets to recurse properly.
1870
- var templatePromise;
1871
-
1872
- // type: "template" is a special case. It can contain a template inline or an url.
1873
- // otherwise we find out the url to the template and load them.
1874
- if (form.type === 'template' && form.template) {
1875
- templatePromise = $q.when(form.template);
1876
- } else {
1877
- var url = form.type === 'template' ? form.templateUrl : templateUrl(name, form);
1878
- templatePromise = $http.get(url, {cache: $templateCache}).then(function(res) {
1879
- return res.data;
1880
- });
1881
- }
1882
- */
1883
- /*
1884
- templatePromise.then(function(template) {
1885
- if (form.key) {
1886
- var key = form.key ?
1887
- sfPathProvider.stringify(form.key).replace(/"/g, '"') : '';
1888
- template = template.replace(
1889
- /\$\$value\$\$/g,
1890
- 'model' + (key[0] !== '[' ? '.' : '') + key
1891
- );
1892
- }
1893
- element.html(template);
1894
- */
1895
- // Do we have a condition? Then we slap on an ng-if on all children,
1896
- // but be nice to existing ng-if.
1897
- /*if (form.condition) {
1898
-
1899
- var evalExpr = 'evalExpr(form.condition,{ model: model, "arrayIndex": arrayIndex})';
1900
- if (form.key) {
1901
- evalExpr = 'evalExpr(form.condition,{ model: model, "arrayIndex": arrayIndex, "modelValue": model' + sfPath.stringify(form.key) + '})';
1902
- }
1903
-
1904
- angular.forEach(element.children(), function(child) {
1905
- var ngIf = child.getAttribute('ng-if');
1906
- child.setAttribute(
1907
- 'ng-if',
1908
- ngIf ?
1909
- '(' + ngIf +
1910
- ') || (' + evalExpr +')'
1911
- : evalExpr
1912
- );
1913
- });
1914
- }*/
1915
- //$compile(element.contents())(scope);
1916
- //});
1917
1864
1918
1865
// Where there is a key there is probably a ngModel
1919
1866
if ( form . key ) {
0 commit comments