formly-js / angular-formly

JavaScript powered forms for AngularJS
http://docs.angular-formly.com
MIT License
2.22k stars 405 forks source link

model value cannot be refreshed in formlyConfigProvider.setType controller #596

Closed TonyLuo closed 8 years ago

TonyLuo commented 8 years ago

I tried to show the preview for the image using ormlyConfigProvider.setType, but it seems the model value sometimes will refer to the previous one. Is something wrong with my code?

formlyConfigProvider.setType({
        name: 'qiniu-single-img',
        templateUrl: 'scripts/components/common/formly-types/elements/qiniu-single-img.html',
        controller: function ($scope, $log, $qupload, AppConstant) {
            $scope.modelValue = $scope.model[$scope.options.key];

qiniu-single-img.html

        <div class="image"><img data-ng-src="{{modelValue}}"  style="width: 50px;"/></div>
benoror commented 8 years ago

Do you mind creating an example of what you're trying to accomplish? Please follow the instructions here: http://help.angular-formly.com

This will make it easier for you to get help. Because the github issues are reserved for bug reports and feature requests, I'm going to go ahead and close this issue. See you on chat! Thanks!