0

hi I have this code on partial view:

var app = angular.module('tableConditions', []); app.controller('conditionsRow', function ($scope){

$scope.options = [{ index: 0 }, { index: 1 }, { index: 2 }];

$scope.addNewRow = function () {
    var newItemNo = $scope.options.length;

    conditionCount = conditionCount + 1;
    $scope.options.push({ 'index': '' + newItemNo });
};

$scope.removeOption = function (selfIndex) {
    var lastItem = $scope.options.length;
    if (lastItem > 0) {
        lastItem = lastItem-1;
    };
    conditionCount = conditionCount -1;
    $scope.options.splice(lastItem);
    $scope.options.splice(selfIndex,1);
};

$scope.GetExceptionColumnValues = function (self, index) {
    var accountingUrl = $("#exceptionUrl")[0].value;

    var ValueInput = "#Condition_" + index + " #ConditionValue";

    $.ajax({
        url: accountingUrl,
        method: "GET",
        data: {
            fieldId: self.index,
            tableName: "Fact_IBNR_DUP_UPR_Reserve"
        },
        success: function (data) {
            $(ValueInput).find("option").remove();
            $.each(data.data[0].Result, function () {
                $(ValueInput).append($("<option   />").val(this.ExceptionValue).text(this.ExceptionValue));
            })
        },
        error: function (response, status, xhr) {
        }
    });
};});

this is called when I call my partial view, but is working only the first time if I add more of one partial views on my page this does not works you know what is the issue this is calling every time for:

 @for (int i = 0; i < Model.Exceptions.Count; i++ )
    {
        <div class="row">
            @{Html.RenderAction("AccountingException", "AccountingException", new { exceptionId = Model.Exceptions[i].AccountExceptionId, accountType = Model.AccountingType });}
        </div>
    }

this is calling only one time please let me know if you can help me

  • If you are going to use angular...get rid of jQuery as well as only use the back end as a data api and populate angular templates with that data. You have a real hodge podge mixture of technologies going on here and are just asking for problems that will be hard to debug – charlietfl Sep 29 '16 at 23:32
  • Strongly suggest reading : [thinking-in-angularjs-if-i-have-a-jquery-background](http://stackoverflow.com/questions/14994391/thinking-in-angularjs-if-i-have-a-jquery-background) – charlietfl Sep 29 '16 at 23:33

0 Answers0