Guest User

Untitled

a guest
Jan 17th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. ERROR Error: StaticInjectorError[CervejaService]:
  2. StaticInjectorError[CervejaService]:
  3. NullInjectorError: No provider for CervejaService!
  4. at _NullInjector.get (core.js:993)
  5. at resolveToken (core.js:1281)
  6. at tryResolveToken (core.js:1223)
  7. at StaticInjector.get (core.js:1094)
  8. at resolveToken (core.js:1281)
  9. at tryResolveToken (core.js:1223)
  10. at StaticInjector.get (core.js:1094)
  11. at resolveNgModuleDep (core.js:10878)
  12. at NgModuleRef_.get (core.js:12110)
  13. at resolveDep (core.js:12608)
  14.  
  15. import { Cerveja } from './../core/model';
  16. import { Injectable } from '@angular/core';
  17. import { Http } from '@angular/http';
  18.  
  19. @Injectable()
  20. export class CervejaService {
  21.  
  22. cervejasUrl = 'http://localhost:8080/cervejas';
  23.  
  24. constructor(private http: Http) { }
  25.  
  26. adicionar(cerveja: Cerveja): Promise<Cerveja> {
  27. return this.http.post(this.cervejasUrl,
  28. JSON.stringify(cerveja))
  29. .toPromise()
  30. .then(response => response.json());
  31. }
  32. }
Add Comment
Please, Sign In to add comment