show my result on modal on ionic

I would like to fetch my generated json result on a modal. may i know how can i do it? At the moment i cant get the modal to slide in when there's result. Thanks.

It shows TypeError: $scope.modal is undefined

.controller('formcontrol', function($scope, $http, $ionicLoading, $ionicModal){
    $scope.show = function() {
        $ionicLoading.show({
            template: 'Loading...'
        });
    };

    $scope.search = function(data){

        if($scope.fsearchr.$pristine){
            alert('Nothing to search.');
        }else{
            data = {
                'text' : $scope.searchr.text,
            };

            $ionicLoading.show({template:'Searching....'});

            $http.post( l + 'search.php', data).
            success(function(data, status, headers, config) {

                $ionicModal.fromTemplateUrl('#/tab/result.html', function($ionicModal) {
                $scope.modal = $ionicModal;
                }, {    
                    scope: $scope,
                    animation: 'slide-in-up',
                }); 

                console.log('show the freaking modal');

                $ionicLoading.hide();
                //$scope.modal.show();
            }).
            error(function(data, status, headers, config) {
                // called asynchronously if an error occurs
                // or server returns response with an error status.
                alert('Error. No result.');
            });
        }
    }
})

$ionicModal.fromTemplateUrl() does not take a function parameter. It returns an instance of the ionicModal class which you can use as a handle for the modal dialog.

  var modal = $ionicModal.fromTemplateUrl('#/tab/result.html', {
    scope: $scope,
    animation: 'slide-in-up',
  });
  modal.open();

Details are available here http://ionicframework.com/docs/api/service/$ionicModal/