Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/385.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在ng模型对象后添加新属性';已通过ng repeat更改_Javascript_Angularjs_Angularjs Scope_Ng Repeat - Fatal编程技术网

Javascript 在ng模型对象后添加新属性';已通过ng repeat更改

Javascript 在ng模型对象后添加新属性';已通过ng repeat更改,javascript,angularjs,angularjs-scope,ng-repeat,Javascript,Angularjs,Angularjs Scope,Ng Repeat,我想在ng repeat块中更改对象后,向ng模型对象添加一个属性“Discentrate” 选择一个选项后,ng模型将按预期更新。但“折扣”并不是作为一项财产添加的。显然,我遗漏了一些关于“范围”的东西。有人会研究这个问题吗?我怎样才能将“去中心化”属性添加到ng模型中 <form class="form-horizontal" ng-submit="addToInvoice()"> <div class="form-group"> <

我想在ng repeat块中更改对象后,向ng模型对象添加一个属性“Discentrate”

选择一个选项后,ng模型将按预期更新。但“折扣”并不是作为一项财产添加的。显然,我遗漏了一些关于“范围”的东西。有人会研究这个问题吗?我怎样才能将“去中心化”属性添加到ng模型中

<form class="form-horizontal" ng-submit="addToInvoice()">
    <div class="form-group">
        <label for="inputService" class="col-sm-2 control-label">Service</label>
        <div class="col-sm-4">
            <select name="data.itemToSave" class="form-control" required="required"
                    ng-options="option.title for option in items.services track by option.id"
                    ng-model="data.itemToSave"></select>
        </div>
    </div>

    <div class="form-group">
        <label for="inputPrice" class="col-sm-2 control-label">Discount</label>

        <div class="readonly" data-toggle="buttons">
            <label class="btn btn-default" ng-class="{active: '!data.itemToSave.discountRate'}">
                <input type="radio" ng-model="data.itemToSave['discountRate']" value="0">0%</label>

            <label class="btn btn-default">
                <input type="radio" ng-model="data.itemToSave['discountRate']" value="10">10%</label>

            <label class="btn btn-default">
                <input type="radio" ng-model="data.itemToSave['discountRate']" value="20">20%</label>
        </div>


    </div>
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-4">
            <button type="submit" class="btn btn-default">Add to Invoice</button>
        </div>
    </div>
</form>

服务
优惠
0%
10%
20%
添加到发票

删除
数据切换=“按钮”
使其工作,无论是否使用
ui.bootstrap


Its似乎与
ng repeat