I have array :

[{"IDAlokasiEmiten":154,"IDOrganization":12,"NamaOrganization":null,"CodeEmiten":"ANTM","NameEmiten":"AAneka Tambang (Persero) Tbk"},{"IDAlokasiEmiten":0,"IDOrganization":null,"NamaOrganization":null,"CodeEmiten":"ADHI","NameEmiten":"Adhi Karya (Persero) Tbk"}]

How to change some value before I post to API ?

I want POST to API into :

[{"IDAlokasiEmiten":0,"IDOrganization":12,"NamaOrganization":null,"CodeEmiten":"ANTM","NameEmiten":"AAneka Tambang (Persero) Tbk"},{"IDAlokasiEmiten":0,"IDOrganization":12,"NamaOrganization":null,"CodeEmiten":"ADHI","NameEmiten":"Adhi Karya (Persero) Tbk"}]

my javascript this :

// GET Detail Alokasi Emiten
    $scope.emit.detailDaftarEmiten = [];
    $scope.addItemAlokasi = function () {
        $scope.emit.detailDaftarEmiten.push({
            IDAlokasiEmiten: 0,
            IDOrganization: 12,
            NamaOrganization: '',
            CodeEmiten: $scope.emit.detailDaftarEmiten.CodeEmiten,
            NameEmiten: $scope.emit.detailDaftarEmiten.NameEmiten
        });
        $scope.emit.detailDaftarEmiten.IDAlokasiEmiten = '';
        $scope.emit.detailDaftarEmiten.IDOrganization = '';
        $scope.emit.detailDaftarEmiten.NamaOrganization = '';
        $scope.emit.detailDaftarEmiten.CodeEmiten = '';
        $scope.emit.detailDaftarEmiten.NameEmiten = ''
    };
    $scope.resetForm = function () {
        $scope.emit.detailDaftarEmiten.IDAlokasiEmiten = ''; 
        $scope.emit.detailDaftarEmiten.IDOrganization = '';
        $scope.emit.detailDaftarEmiten.NamaOrganization = '';
        $scope.emit.detailDaftarEmiten.CodeEmiten = '';
        $scope.emit.detailDaftarEmiten.NameEmiten = ''
    };
    $scope.deleteItem = function (index) {
        $scope.emit.detailDaftarEmiten.splice(index, 1);
    };
    $scope.getTotalItems = function () {
        return $scope.detailDaftarEmiten.length;
    };

but doesnt work :(

I want to set all value array for (IDAlokasiEmiten=0 and IDOrganization=12). Thanks for attention.

Related posts

Recent Viewed