消息:httppost中的“非法返回声明”

时间:2018-09-05 05:23:18

标签: api http ionic-framework

HTTP POST的响应正在POSTMAN API测试工具中运行, 我正在尝试仅在API HTTP POST中验证用户名和密码

enter image description here

rest.ts代码在

下方
            import { Injectable } from '@angular/core';
            import { Http,HttpModule } from '@angular/http';
            import { Observable } from 'rxjs/Observable';
            import 'rxjs/add/operator/map';
            import 'rxjs/add/operator/catch';
            import 'rxjs/add/operator/finally';
            import 'rxjs/add/observable/throw';



            /*
              Generated class for the RestProvider provider.

              See https://angular.io/guide/dependency-injection for more info on providers
              and Angular DI.
            */
            @Injectable()

            export class RestProvider {

              // apiUrl = 'http://localhost:54117/api/Employees/GetEmployeeByID/1'
              apiUrl = 'http://localhost:54117/api/Employees/CheckCredentials/obj/'
              debugger;
              constructor(public http: Http) {
                console.log('Hello RestProvider Provider');
              }


              login(body) {
                debugger;

                console.log('body is',body);
               return  this.http.post(this.apiUrl, body).map(resp => resp.json());
              }

0 个答案:

没有答案