Angular JS error var undefined

0

Good evening I have this function link if I give an alert; inside the function (below the date) ok, but if I invoke the function in the undefined controller. How can I solve? Thank you

    
asked by anonymous 29.04.2017 / 04:41

1 answer

0
$scope.convertMd5 = function (string) { // retorna string em md5
    return $http({
        method: 'POST',
        url: '../assets/php/client/Users.php',
        data: {ref: 'convert-md5', str: string},
        dataType: 'html',
    });
}
$scope.convertMs5('aaaa').success(function (data) {
        //o que quer fazer
    });

$ http works async, what happens is that the sl variable has only been set but no value and fc returns before the $ http response.

    
29.04.2017 / 05:02