【问题标题】:Angular ng-resource configuration binding with object?Angular ng-resource 配置与对象绑定?
【发布时间】:2015-12-10 06:19:14
【问题描述】:

我花了几个小时试图解决这个非常简单的问题。 我有绑定到支付对象 (ng-model="payment.newPaymentLine.method") 的 ng-model 属性,如下所示:

<div class="form-group form-inline">
                    <label>Payment Method:</label>
                    <select class="form-control"
                            ng-model="payment.newPaymentLine.method"
                            ng-options="paymentMethod for paymentMethod  in payment.paymentMethods" required></select>
                </div>

我想知道如何配置与该属性绑定的 ng-resource,我尝试了以下格式(“@payment.newPaymentLine.method”)但它不起作用:

 classContext.bankRepository = classContext.salesOrderResource(
                    classContext.appConfig.getApiEndPoint(classContext.appConfig.apiPath.payment) + "/:PaymentMethod/banks"
                    , { PaymentMethod: "@payment.newPaymentLine.method" });

顺便说一句,我正在使用类型脚本 1.5

【问题讨论】:

    标签: angularjs typescript ngresource


    【解决方案1】:

    我想我误解了 ng-resource 的概念,参数应该绑定到数据对象属性而不是上下文对象

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-04-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-01
      • 1970-01-01
      相关资源
      最近更新 更多