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

72 lines
3.1 KiB
JavaScript

angular.
module('catalog').
component('anList',{
templateUrl : localized.partials + 'catalog.template.html',
//'<a ng-repeat="item in $ctrl.catalog" class="square" style="background-image:url(\'{{item.img}}\');" ng-href="#!/catalog/{{item.id}}"></a>',
controller :
function($scope, $http, $routeParams) {
$http.get('wp-json/wp/v2/entrevista').then(function(res) {
console.log(res.data);
$scope.entrevistas = res.data;
});
}
/*function anListController() {
this.catalog = [
{ id: '1', title: 'Item 1', description: 'Description 1', img: 'assets/anorga1.jpg'},
{ id: '2',title: 'Item 2', description: 'Description 2', img: 'assets/anorga2.jpg'},
{ id: '3', title: 'Item 2', description: 'Description 2', img: 'assets/anorga3.jpg'},
{ id: '4', title: 'Item 2', description: 'Description 2', img: 'assets/anorga4.jpg'},
{ id: '5', title: 'Item 2', description: 'Description 2', img: 'assets/anorga5.jpg'},
{ id: '6', title: 'Item 2', description: 'Description 2', img: 'assets/anorga6.jpg'},
{ id: '7', title: 'Item 2', description: 'Description 2', img: 'assets/anorga7.jpg'},
{ id: '8', title: 'Item 2', description: 'Description 2', img: 'assets/anorga8.jpg'},
{ id: '9', title: 'Item 2', description: 'Description 2', img: 'assets/anorga9.jpg'},
{ id: '9', title: 'Item 2', description: 'Description 2', img: 'assets/anorga.jpg'},
{ id: '9', title: 'Item 2', description: 'Description 2', img: 'assets/anorga1.jpg'},
{ id: '9', title: 'Item 2', description: 'Description 2', img: 'assets/anorga3.jpg'},
{ id: '9', title: 'Item 2', description: 'Description 2', img: 'assets/anorga5.jpg'},
{ id: '9', title: 'Item 2', description: 'Description 2', img: 'assets/anorga2.jpg'},
{ id: '10', title: 'Item 2', description: 'Description 2', img: 'assets/anorga10.jpg'}
]
}*/
});
angular.
module('catalog').
component('anHome',{
templateUrl: localized.partials + 'home.template.html',
controller: function($scope, $rootScope, $http, $routeParams) {
console.log($rootScope.loading);
$scope.loading = true;
window.scrollTo(0,0);
$http.get('wp-json/wp/v2/slideshow').then(function(res) {
$scope.slides = res.data;
$scope.loading = false;
});
}
});
angular.
module('catalog').
component('anContact',{
templateUrl: localized.partials + 'contact.template.html'
});
angular.
module('catalog').
component('anInfo',{
templateUrl: localized.partials + 'info.template.html'
});
angular
.module('catalog')
.component('anContent',{
templateUrl: localized.partials + 'content.template.html',
controller: function($scope, $http, $routeParams, $sce) {
console.log($routeParams.slug);
window.scrollTo(0,0);
$http.get('wp-json/wp/v2/pages/?slug='+$routeParams.slug).then(function(res) { $scope.post = res.data[0]; $scope.content = $sce.trustAsHtml($scope.post.content.rendered); });
}
});