点击angularjs

时间:2016-11-07 12:29:29

标签: angularjs

这是我的角色

中的html块
<div class="form-group" ng-repeat="n in [1, 2, 3, 4, 5, 6]">  
<div class="choice-div" ng-if="webfront.customer_fields[$index].input_type == 4">
    <label class="col-sm-3 control-label no-padding-right" for="form-field-1">Choices : </label>
    <div class="col-sm-9">                                                    
        <div ng-repeat="textBox in webfront.customer_fields[$index].webfront_field_values" class="addtext-div">                                                       
            <input ng-model="textBox.value" class="col-xs-10 col-sm-5 addtext_box" type="text" id="{{textBox.id}}" required=""  placeholder="Value" autocomplete="off" style="width: 40%;">
            <span  ng-click="removeTextBox(webfront.customer_fields[$parent.$index].webfront_field_values, $index, textBox.id)" style="margin-left: 20px;cursor: pointer;"> <i title="Cancel this option!" class="raty-cancel cancel-off-png" data-alt="x"></i></span>
        </div>   
        <span class="btn btn-sm btn-success" ng-click="addTextBox(webfront.customer_fields[$index].webfront_field_values)"><i class="ace-icon fa fa-plus"></i> Add Option</span>
        <br class="clear"/>                                                     
    </div>
</div>

This is my output of json formatted angular data

webfront{"id":1,"customer_fields":[{"id":24,"webfront_id":1,"name":"CA1","webfront_field_values":[]},{"id":25,"webfront_id":1,"name":"Education","webfront_field_values":[{"id":14,"webfront_field_id":25,"value":"B.tech"},{"id":15,"webfront_field_id":25,"value":"MCA"},{"id":16,"webfront_field_id":25,"value":"MBA"}],"customer_checkbox":true}]} 

下面我已经将图片包含在我的html

Add option image with data

虽然上面提到的输入字段中的数据正常工作

Add option image with no data

但是虽然没有数据,但只有添加选项。而新文本字段的添加选项不起作用。

我希望添加选项顶部应该有一个文本字段,而点击添加选项新文本字段应该带有删除选项。任何人都可以帮我解决这个问题。

0 个答案:

没有答案