anorgatarrak-wordpress-theme/app/catalog/item.component.js

27 lines
1.1 KiB
JavaScript

angular.
module('item').
component('anDetail', {
templateUrl: localized.partials + '/item-detail.template.html',
controller: function($scope, $rootScope, $http, $routeParams, $sce, SubdomainService, gettextCatalog) {
//console.log($routeParams.slug);
$scope.lang = SubdomainService.subdomain;
console.log($scope.lang);
if ($scope.lang=='eus') { gettextCatalog.setCurrentLanguage('eu_ES');}
//else { gettextCatalog.setCurrentLanguage('es');}
$http.get('wp-json/wp/v2/entrevista/?slug='+$routeParams.slug).then(function(res) {
console.log(res.data[0]);
$scope.post = res.data[0];
$rootScope.lanEs = $scope.post.link_es;
$rootScope.lanEu = $scope.post.link_eu;
});
}
// controller: ['$routeParams',
// function ItemDetailController($routeParams) {
// this.itemId = $routeParams.itemId;
// $http.get('wp-json/wp/v2/entrevistas/?slug='+$routeParams.slug).then(function(res) { $scope.post = res.data[0]; $scope.content = $sce.trustAsHtml($scope.post.content.rendered); });
// }
//]
});