hi guys
i use paginate gem on ruby on rails this gem set X-Total-page and link on
header ! i can see this varables on postman application but on angular i
cant see this varables and on call variable console return null !
api service
export class TehranjsApiService {
BASE_URL="http://localhost:3000/api/v1";
constructor(private http: Http) { }
getHeader = () => {
let headers = new Headers();
headers.append("Content-Type", 'application/json');
return headers;
};
getArticles(limit:number=10) : any {
return this.http.get(`${this.BASE_URL}/articles.json?limit=${limit}`,
this.getHeader)
.map((response: Response) => {
// some response manipulation
return response
})
.toPromise();
}
and home component
import { Component, OnInit } from '@angular/core';
import { TehranjsApiService } from '../../../../shared/shared';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {
articles: any;
constructor(public tJs: TehranjsApiService) { }
ngOnInit() {
this.tJs.getArticles().then(
data => { this.articles= data.json().articles; console.log(data.
headers.get('link'))} , //success
error => console.log('error', error),
() => {console.log('call finished')}
)
}
}
link return null but i can see this on postman :(
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" 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 https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.