Javascript 与angular formly一起使用时,angular upload不填充模型

Javascript 与angular formly一起使用时,angular upload不填充模型,javascript,angularjs,angular-formly,Javascript,Angularjs,Angular Formly,options.data.fieldToMatch 大家好,请容忍我,因为这是我在StackOverflow上的第一篇文章。我多年来一直是匿名用户,总是通过搜索找到问题的答案。然而,这一点让我有点困惑 我在使用angular 1.4将angular上传与angular formly集成时遇到问题。选择文件时,表单模型不会得到更新 我在jsbin at上有一个代码示例,在plunkr at上有相同的代码 以下是上述2个链接上的相同代码: Javascript: (function() { 'u

options.data.fieldToMatch

大家好,请容忍我,因为这是我在StackOverflow上的第一篇文章。我多年来一直是匿名用户,总是通过搜索找到问题的答案。然而,这一点让我有点困惑

我在使用angular 1.4将angular上传与angular formly集成时遇到问题。选择文件时,表单模型不会得到更新

我在jsbin at上有一个代码示例,在plunkr at上有相同的代码

以下是上述2个链接上的相同代码:

Javascript:

(function() {
  'use strict';

  var app = angular
    .module('app', ['lr.upload', 'formly', 'formlyBootstrap']);

  app.run(['formlyConfig', function(formlyConfig) {
    formlyConfig.setType({
      name: 'licensefile',
      extends: 'input',
      defaultOptions: {
        ngModelAttrs: {
          multiple: {
            bound: 'ng-multiple',
            attribute: 'multiple'
          },
          accept: {
            bound: 'ng-accept',
            attribute: 'accept'
          }
        },
        templateOptions: {
          label: 'License File',
          type: 'file',
          required: true,
          multiple: false,
          accept: '*.lic'
        },
        validation: {
          messages: {
            required: function(viewValue, modelValue, scope) {
              //return scope.to.label + ' is required '
              return 'Please select a license file';
            }
          }
        }
      }
    });

    formlyConfig.setType({
      name: 'email',
      extends: 'input',
      defaultOptions: {
        templateOptions: {
          type: 'email',
          label: 'Email Address',
          placeholder: 'email address',
          pattern: '[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)',
          message: '$viewValue + " is not a valid email address"'
        },
        validation: {
          messages: {
            required: function(viewValue, modelValue, scope) {
              return 'Please enter an email address';
            },
          }
        }
      }
    });
  }]);

  app.controller('AppController', function() {
    var vm = this;
    vm.model = {};
    vm.fields = [{
      type: 'licensefile',
      key: 'lfile',
      templateOptions: {
        label: 'License File',
        focus: true,
      }
    }, {
      type: 'input',
      key: 'someTextField',
      templateOptions: {
        label: 'Some Text'
      }
    }];
  });
}());
Html:


{{vm.model}json}
如果您能提供任何帮助和指导,说明为什么模型没有使用选定的文件进行更新,我们将不胜感激

提前感谢,,
Michael

他的上传有什么进展吗?angular upload没有使用
ng型号
<!DOCTYPE html>
<html ng-app="app">

  <head>
    <script data-require="angular.js@*" data-semver="1.4.1" src="https://code.angularjs.org/1.4.1/angular.js"></script>
    <script src="//rawgit.com/leon/angular-upload/master/angular-upload.min.js"></script>
    <script src="//rawgit.com/kentcdodds/apiCheck.js/master/dist/api-check.js"></script>
    <script src="//rawgit.com/formly-js/angular-formly/master/dist/formly.js"></script>
    <script src="//rawgit.com/formly-js/angular-formly-templates-bootstrap/master/dist/angular-formly-templates-bootstrap.min.js"></script>

    <script src="app.js"></script>

    <link rel="stylesheet" href="style.css" />
    <script src="script.js"></script>
  </head>

  <body ng-controller="AppController as vm">
    <pre>{{vm.model | json}}</pre>
    <form name="fileForm" >
      <formly-form model="vm.model" fields="vm.fields" ></formly-form>
    </form>
  </body>

</html>