Guest User

Untitled

a guest
May 17th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. import { MyDataService } from './services/my-data.service';
  2. constructor(private posting: MyDataService
  3. ) {}
  4.  
  5. ngOnInit() {
  6. this.posting.postMethod().subscribe(
  7. (response => {
  8. console.log(response)
  9. }));
  10. }
  11. }
  12.  
  13. @Injectable()
  14.  
  15. export class MyDataService {
  16.  
  17. constructor(private http: Http)
  18. { }
  19.  
  20.  
  21. postMethod(model: any ) {
  22. return this.http.post("http ://", model)
  23. .map(res => res.json());
  24. }
  25. }
Add Comment
Please, Sign In to add comment