HTTP POST的响应正在POSTMAN API测试工具中运行, 我正在尝试仅在API HTTP POST中验证用户名和密码
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());
}