Sign In Register

How can we help you today?

Start a new topic

integration of angularjs with gamespark

 i can´t put work my custom event work withe angularjs

not using angular js works fine
function getnews() {
        gamesparks.sendWithData(
            "LogEventRequest",
            {
                eventKey : "getnews",
                news_author:"",
                news_title:"",
               
            },
            function(response){
                console.log(JSON.stringify(response));
}
        );
    }
    function loginResponse(response) {
        console.log(JSON.stringify(response));
    }
   
var app = angular.module("sa_app", ['ui.bootstrap']);

app.filter('startFrom', function() {
    return function(input, start) {
        if(input) {
            start = +start; //parse to int
            return input.slice(start);
        }
        return [];
    }
});
app.controller("controller", function($scope, $http,$timeout) {

    $scope.show_data = function() {
        $http.get("News/getnews.php")
            .success(function(data) {
                $scope.news = data;
                $scope.currentPage = 1;
            //current page
            $scope.entryLimit = 5;
            //max no of items to display in a page
        $scope.filteredItems = $scope.news.length;
            //Initially for no filter
            $scope.totalItems = $scope.news.length;
            });
    }

        $scope.setPage = function(pageNo) {
        $scope.currentPage = pageNo;
    };

    $scope.filter = function() {
        $timeout(function() {
            $scope.filteredItems = $scope.filtered.length;
        }, 10);
    };
    $scope.sort_by = function(predicate) {
        $scope.predicate = predicate;
        $scope.reverse = !$scope.reverse;
    };

});
i can´t put work my custom event work withe angularjs
not using angular js works fine
function getnews() {
        gamesparks.sendWithData(
            "LogEventRequest",
            {
                eventKey : "getnews",
                news_author:"",
                news_title:"",
               
            },
            function(response){
                console.log(JSON.stringify(response));
}
        );
    }
    function loginResponse(response) {
        console.log(JSON.stringify(response));
    }
   
var app = angular.module("sa_app", ['ui.bootstrap']);

app.filter('startFrom', function() {
    return function(input, start) {
        if(input) {
            start = +start; //parse to int
            return input.slice(start);
        }
        return [];
    }
});
app.controller("controller", function($scope, $http,$timeout) {

    $scope.show_data = function() {
        $http.get("News/getnews.php")
            .success(function(data) {
                $scope.news = data;
                $scope.currentPage = 1;
            //current page
            $scope.entryLimit = 5;
            //max no of items to display in a page
        $scope.filteredItems = $scope.news.length;
            //Initially for no filter
            $scope.totalItems = $scope.news.length;
            });
    }

        $scope.setPage = function(pageNo) {
        $scope.currentPage = pageNo;
    };

    $scope.filter = function() {
        $timeout(function() {
            $scope.filteredItems = $scope.filtered.length;
        }, 10);
    };
    $scope.sort_by = function(predicate) {
        $scope.predicate = predicate;
        $scope.reverse = !$scope.reverse;
    };

});
Login to post a comment