Thanks. But I need someone explain my code . 

-----Original Message-----
From: "Hai Huynh" <[email protected]>
Sent: ‎9/‎22/‎2015 12:59 AM
To: "AngularJS" <[email protected]>
Subject: [AngularJS] Re: factory http get explanation

Maybe help you
  
// Update or add new one  customer
    $scope.PostCustomer = function () {
        $.post("api/customerapi",
                     $("#cusForm").serialize(),
                     function (value) {


                         // Refresh list
                         $http.get("/api/customerapi")
                         .success(function (response) {
                             $scope.Customer = response
                         });


                         alert("Saved successfully.");
                     },
                     "json"
               );
    }


    // Delete one customer based on id.
    $scope.delCustomer = function (id) {
        if (confirm("Are you sure you want to delete this customer?")) {
            // todo code for deletion
            $http.delete("api/customerapi/" + id).success(function () {
                alert("Deleted successfully.");
                // Refresh list
                $http.get("/api/customerapi")
                .success(function (response) {
                    $scope.Customer = response
                });


            }).error(function () {
                alert("Error.");
            });
        }
    };


$http.get example here 


-- 
You received this message because you are subscribed to a topic in the Google 
Groups "AngularJS" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/angular/9ts4H7IlN_E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to 
[email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to