angular-schema-form-material icon indicating copy to clipboard operation
angular-schema-form-material copied to clipboard

model with previus data not showing correctly

Open drtobal opened this issue 8 years ago • 4 comments

Hi,

I am creating a form with only inputs of text, and is working ok. but when I put a model with data previusly loaded, the text int the input don't show correctly, but if I click the input, then the text is showed.

How can I fix this?

Thanks!!.

drtobal avatar Mar 10 '17 14:03 drtobal

any help on this?

drtobal avatar Mar 14 '17 01:03 drtobal

@drtobal sure, but I can't debug code I can't see :) You will need to provide a plunker to get help debugging something, I also need to know what version you are using of both asf and asfm. Also asfm has not been updated to work with the asf alpha yet, so if you are using the alpha that could be the issue.

Anthropic avatar Mar 14 '17 02:03 Anthropic

This dirty fix make it work on ASFM 1.0.0-alpha.1 with ASF 1.0.0-alpha.4 :

$rootScope.$on('sf-render-finished', (event, el) => {
    $timeout(() => {
        el[0].querySelectorAll('md-input-container').forEach((input) => {
            if (angular.element(input).scope().ngModel.$viewValue) {
                input.classList.add('md-input-has-value');
            }
        });
    });
});

de-luca avatar Jun 12 '17 13:06 de-luca

@de-luca note that using .scope() will not work if you disable debug info (which is recommended in production builds)

mnzaki avatar Jun 15 '17 16:06 mnzaki