Error in http:
Failed to load resource: the server responded with a status of 404 (Not 
Found)
perfil:1 XMLHttpRequest cannot load 
http://localhost:50112/WSAdministrador/EInsertaPerfil. Response for 
preflight has invalid HTTP status code 404

my code is:

export class Service {
    private baseUrl = 'http://localhost:50112/WSAdministrador/';
    //private mUrl = 'http://jsonplaceholder.typicode.com/posts?userId=1';  
    constructor(@Inject(Http)private http: Http) { }
   
    private extractData(res: Response) {
        let body = res.json();
        console.log(body);
        if (body) {
            return body;
        }
        else {
            return [];
        }
    }

    addPerfil(inserta:EInsertaPerfil): Promise<Resultado> {
        let body1 = JSON.stringify(inserta);
        
        console.log(body1);
        let headers = new Headers({'Content-Type': 'application/json'});
        let options = new RequestOptions({ headers: headers });       

        return this.http.post(this.baseUrl+'EInsertaPerfil', body1,options)
            .toPromise()
            .then(this.extractData)
            .catch(this.handleError);
    }

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to