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

27 lines
1.1 KiB
JavaScript
Raw Normal View History

angular.
module('item').
component('anDetail', {
2017-11-09 19:40:49 +01:00
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) {
2018-02-15 19:26:12 +01:00
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); });
// }
//]
});