Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- readLink(url: string) {
- this.isBusy = true;
- this._http.get(`${this._helper.baseURL}/api/post/readlink?url=${encodeURIComponent(url)}`)
- .subscribe(
- data => {
- this.processResponse(data, url);
- },
- (err: HttpErrorResponse) => {
- }
- );
- }
- processResponse(result, url) {
- if (result.images != null && result.images.length > 0) {
- result.images.forEach(el => {
- this.getMeta(el, function (res) {
- this.images.push(res);
- this.currentImage = this.images[0];
- });
- });
- }
- alert( this.images.length); // this always give zero and this was executed before my call bakc
- }
- getMeta(url, callback) {
- const img = new Image();
- img.src = url;
- img.onload = function () {
- if (img.width > 260 && img.height > 150) {
- callback(url);
- }
- };
Add Comment
Please, Sign In to add comment