In the view, I have a html which is a tabs with 3 sessions and when I click
each of these tabs, I show different data. From different json.
This is my code
'use strict';
var app = angular.module('App');
app.service('datosServicios', function($q, $http) {
var datosPlayas = function(ruta) {
var deferred = $q.defer();
$http({
method: 'GET',
url: 'scripts/datos/dato.json',
params: 'limit=3, sort_by=created:desc'
}).success(function(data){
deferred.resolve(data);
}).error(function(){
console.log("error");
});
return deferred.promise;
}
return {datosPlayas: datosPlayas}
})
app.controller('MainCtrl', function ($scope, datosServicios) {
datosServicios.datosPlayas().then(function(data) {
$scope.datos = data;
})
});
Thanks ;)
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.