保存动态创建的输入的值

时间:2018-04-27 15:44:31

标签: angularjs

我正在尝试将输入数据保存到<div class="row"> <div class="form-group col-md-10"> <label for="codigoInput" class="control-label">Descripción</label> <button type="button" onclick="addFields()" class="btn btn-default btn-sm" style="margin-bottom: 5px">Agregar campos</button> <input style="margin-bottom: 3px" type="text" class="form-control input-sm" next-focus tabindex="0" placeholder="Escribe una característica del módulo" ng-repeat="d in modulo.descripcion" ng-model="d"> <small class="help-block with-errors desc"></small> </div> </div> <a ng-click="saveEdit(modulo)" class="btn btn-success btn-sm">Guardar</a> 。但它不起作用。我只是回到初始值,而不是新值。

HTML

function addFields() {
    var set = $('.desc');
    var length = set.length-1;
    $('<input style="margin-bottom: 3px" type="text" class="form-control input-sm" next-focus tabindex="0" placeholder="Escribe una característica del módulo" ng-model="d">').insertBefore($('small.desc'));
}

JS

Dim x, Emails()
Dim strEmails As String

x = Range("EmailNamedRange").Value
Emails() = Application.Index(x, 0, 1)

strEmails = Join(Application.Transpose(Emails), ";")

With xOutMail
    .To = strEmails
    .CC = ""
    .BCC = ""
    .Subject = Range("G2") & " Shift Turnover Report"
    .Body = xMailBody
    .Attachments.Add Application.ActiveWorkbook.FullName
    .Send
End With

1 个答案:

答案 0 :(得分:1)

最好的方法是在modulo.descripcion数组中插入一个新对象,这样重复会自动填充输入,你也可以将新项目添加为ng-model。

像那样:

$scope.addField = function(){

modulo.descripcion.push({type:'number', value=''})

}