item.js 1.04 KB
/**
 * Created by Develop-SC on 1/7/2559.
 */
/**
 * Created by Develop-SC on 30/6/2559.
 */
angular.module('Item', [])
    .controller('CtrlItem', ['$scope', '$http', function($scope, $http) {

    $scope.addItems = function(username,macaddr) {
        //var conCheck = confirm('     คุณแน่ใจว่าหรือไม่ว่าจะเพิ่ม \n\n     Username :  '+$scope.contact.username+'\n     Mac Address :  '+$scope.contact.macaddr);
        var conCheck = true;
        if(conCheck){
            $scope.checkBtn = false;
            $http.post(host+'/api/items', $scope.contact).success(function(response) {
                $scope.contactlist = response;
                console.log(response);
                $scope.checkBtn = false;
                if(response.resultCode == 20000){
                    $scope.success = true;
                    $scope.fail = false;
                }else{
                    $scope.success = false;
                    $scope.fail = true;
                }
            });
        }
    };
}]);