/**
 * Created by jaskokoyn on 2/17/2015.
 */
owlChatApp.controller( "searchCtrl", ["$scope", "$http", function($scope, $http){
    $scope.searchObj        =   {
        term:                   null,
        sort:                   1
    };
    $scope.searchResults    =   searchResults;

    $scope.search           =   function(){
        $http({
            url: "actions/search.php",
            method: "POST",
            data: $scope.searchObj
        }).success(function(data, status, headers, config) {
            $scope.searchResults    =   [];

            data.results.forEach(function(ele,ind,arr){
                $scope.searchResults.push(ele);
            });
        });
    };
}]);