1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- import { AuthServiceService } from './../../shared/auth-service.service';
- import { HttpClient } from '@angular/common/http';
- import { Component, OnInit } from '@angular/core';
- import { Router } from '@angular/router';
- import { NgxSpinnerService } from 'ngx-spinner';
- @Component({
- selector: 'app-news-pages',
- templateUrl: './news-pages.component.html',
- styleUrls: ['./news-pages.component.css']
- })
- export class NewsPagesComponent implements OnInit {
- constructor(private http: HttpClient,
- private authSer: AuthServiceService,
- private spinner: NgxSpinnerService,
- private router: Router) { }
- myInnerHeight = window.innerHeight;
- dataPagesNews= [];
- perPagePagenation: number = 10;
- count: number;
- currentPage:number = 1;
- ngOnInit() {
- this.spinner.show();
- console.log(this.authSer.pathImg);
- this.http.get(this.authSer.pathApi + '/reports_list_gate/' + this.currentPage + '/' + this.perPagePagenation + '/internal').subscribe(
- (responce) => {
- console.log(responce);
- this.dataPagesNews = responce['reports'];
- this.count = responce['count'];
- for(let i = 0 ; i < this.dataPagesNews.length ; i++) {
- if(this.dataPagesNews[i].description.length > 60) {
- this.dataPagesNews[i].description = this.dataPagesNews[i].description.substring(0,200) + '........' ;
- this.dataPagesNews[i].description_en = this.dataPagesNews[i].description_en.substring(0,200) + '......';
- }
- }
- this.spinner.hide();
- },
- (error) => {
- console.log(error);
- }
- )
- }
- // /change page
- onPageChange(pagenationNumber) {
- this.spinner.show();
- this.http.get(this.authSer.pathApi + '/reports_list_gate/' + this.currentPage + '/' + this.perPagePagenation + '/internal').subscribe(
- (responce) => {
- console.log(responce);
- this.dataPagesNews = responce['reports'];
- this.count = responce['count'];
- for(let i = 0 ; i < this.dataPagesNews.length ; i++) {
- if(this.dataPagesNews[i].description.length > 60) {
- this.dataPagesNews[i].description = this.dataPagesNews[i].description.substring(0,200) + '........' ;
- this.dataPagesNews[i].description_en = this.dataPagesNews[i].description_en.substring(0,200) + '......';
- }
- }
- },
- (error) => {
- console.log(error);
- }
- )
- };
- onGetNew(id) {
- this.router.navigate(['InternalPage/news/' + id])
- }
- }
|