Ionic erro when build

When i run ionic build android –-release,but it has no error, when I squeeze in the ionic serve, PLEASE I NEED HELP …
ERROR : https://imgur.com/a/7YcCw

Read the error message. You are using the wrong command. It explicitly tells you the correct one.

1 Like



i try… pls check image

Please someone help me, I do not know what to do anymore, I am 3 days in this error looking for a solution

One thing you could try is to post text as text instead of images.

You actually have a few options here, but use generics to cast it to the type you’re expecting.

http.get<IUsers[]>(this.productUrl).subscribe(data => ...

   // or in the subscribe
   .subscribe((data: IUsers[]) => ...

Also I’d recommend using async pipes in your template that auto subscribe / unsubscribe, especially if you don’t need any fancy logic, and you’re just mapping the value.

users: Observable<IUsers[]>; // different type now

this.users = this.http.get<IUsers[]>(this.productUrl);

// template:
*ngFor="let user of users | async"

Instead you should use Observables.

example

import { Injectable } from '@angular/core';
import { Http, Response, RequestOptions, Headers } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
@Injectable()
export class DataServiceProvider {
  constructor(public http: Http) {}

  //For Get Method
  getService(url) {
       let headers = new Headers({"content-type":"application/json"});
    let reqOptions = new RequestOptions({ headers: headers });
    return this.http.get(url, reqOptions)
      .map(this.extractData)
      .catch(this.catchError);
  }

  //For Get Method with Parameter
  getServicesParameter(url, params): Observable<any> {
       let headers = new Headers({"content-type":"application/json"});
    let reqOptions = new RequestOptions({ headers: headers, params: params });
    return this.http.get(url, reqOptions)
      .map(this.extractData)
      .catch(this.catchError);
  }

  //Post Method Services
  postService(url, data): Observable<any> {
    let headers = new Headers({"content-type":"application/json"});
    let reqOptions = new RequestOptions({ headers: headers });
    let body = JSON.stringify(data);
    return this.http.post(url, body, reqOptions)
      .map(this.extractData)
      .catch(this.catchError);
  }

  //Extract Data
  private extractData(res: Response) {
    return res.json();
  }

  //Catch Error
  private catchError(error: Response | any) {
    let errMsg: string;
    if (error instanceof Response) {
      const err = error || '';
      errMsg = `${error.status} - ${error.statusText || ''} ${err}`;
    } else {
      errMsg = error.message ? error.message : error.toString();
    }
    return Observable.throw(errMsg);
    // return Observable.throw(error.json().error || "System Error.");
  }
}