I'm writing a driver in AngularJS that calls http.get to an API, and returns a 0 (for now). I can show the 0 by console without problems, but I can not show it in a $ scope in the front.
App.js
.controller('ssnGenAltaCtrl', ['$scope', '$http',
function($scope, $http){
$scope.data = {};
$scope.generarRubricaAlta = function(data){
$http({
method: 'GET',
url: 'url'
}).then(function successCallback(data) {
console.log(data.data);
$scope.data.mensaje = data.data;
}, function errorCallback(data) {
console.log("Error");
});
}
}]);
HTML
<div>
<a class="btn btn-default" href="#" role="button" ng-click="generarRubricaAlta()">Generar Rubrica Alta</a>
<p class="bg-primary">{{data.mensaje}}</p>
</div>
Routing
.when("/ssnGenAlta", {
templateUrl : "views/ssnGenAlta.html",
controller: "ssnGenAltaCtrl"
})
The controller I have declared it in the routing. You are not giving me any errors right now by console, but when you click on the button it shows me the 0 returned by console but not in the front.