Look at my Angular Front End project
Now look at my Java Back-end project with Spring Boot
Do not worry about my Back-end project, it's working fine, the problem is my angled Front End project, I'm trying to load a grid and I'm not getting it because it's causing an error in the Angular consoles, but before I look at the files that I changed.
See my project running before changes:
Fileapp.modules.tsBefore:
@NgModule({declarations:[AppComponent],imports:[BrowserModule,EstilosModule,CoreModule,CevejasModule,ClientesModule,UsuariosModule,BrowserAnimationsModule],providers:[],bootstrap:[AppComponent]})exportclassAppModule{}
Afterchanges:
@NgModule({declarations:[AppComponent],imports:[BrowserModule,EstilosModule,CoreModule,CevejasModule,ClientesModule,UsuariosModule,HttpModule,BrowserAnimationsModule],providers:[EstiloService],bootstrap:[AppComponent]})exportclassAppModule{}
SearchTypeBefore:
exportclassEstiloPesquisaComponent{}
Afterchanges:
exportclassEstiloPesquisaComponentimplementsOnInit{estilos=[];constructor(privateestiloService:EstiloService){}ngOnInit(){this.pesquisar();}pesquisar(){this.estiloService.pesquisar().then(estilos=>this.estilos=estilos);}}
Ithinkmyproblemisinthiscodebelow:
StyleServiceFile
Before:
@Injectable()exportclassEstiloService{}
Afterchanges:
@Injectable()exportclassEstiloService{estilosUrl='http://localhost:8080/estilos';constructor(privatehttp:Http){}pesquisar():Promise<any>{returnthis.http.get('${this.estilosUrl}').toPromise().then(response=>{console.log(response.json());});}}
AfterImakethechangesitgeneratesthiserror:
ERRORin./src/app/app.module.tsModulenotfound:Error:Can'tresolve'@angular/http/src/http_module'in'C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\app'resolve'@angular/http/src/http_module'in'C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\app'Parsedrequestisamoduleusingdescriptionfile:C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\package.json(relativepath:./src/app)Field'browser'doesn'tcontainavalidaliasconfigurationafterusingdescriptionfile:C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\package.json(relativepath:./src/app)resolveasmoduleC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\app\node_modulesdoesn'texistorisnotadirectoryC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\node_modulesdoesn'texistorisnotadirectoryC:\Users\Wladimir\Desktop\projetocervejaria\node_modulesdoesn'texistorisnotadirectoryC:\Users\Wladimir\Desktop\node_modulesdoesn'texistorisnotadirectoryC:\Users\Wladimir\node_modulesdoesn'texistorisnotadirectoryC:\Users\node_modulesdoesn'texistorisnotadirectoryC:\node_modulesdoesn'texistorisnotadirectorylookingformodulesinC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\node_modulesusingdescriptionfile:C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\package.json(relativepath:./node_modules)Field'browser'doesn'tcontainavalidaliasconfigurationafterusingdescriptionfile:C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\package.json(relativepath:./node_modules)usingdescriptionfile:C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\node_modules\@angular\http\package.json(relativepath:./src/http_module)noextensionField'browser'doesn'tcontainavalidaliasconfigurationC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\node_modules\@angular\http\src\http_moduledoesn'texist.tsField'browser'doesn'tcontainavalidaliasconfigurationC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\node_modules\@angular\http\src\http_module.tsdoesn'texist.jsField'browser'doesn'tcontainavalidaliasconfigurationC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\node_modules\@angular\http\src\http_module.jsdoesn'texistasdirectoryC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\node_modules\@angular\http\src\http_moduledoesn'texistlookingformodulesinC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\node_modulesusingdescriptionfile:C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\package.json(relativepath:./node_modules)Field'browser'doesn'tcontainavalidaliasconfigurationafterusingdescriptionfile:C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\package.json(relativepath:./node_modules)usingdescriptionfile:C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\node_modules\@angular\http\package.json(relativepath:./src/http_module)noextensionField'browser'doesn'tcontainavalidaliasconfigurationC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\node_modules\@angular\http\src\http_moduledoesn'texist.tsField'browser'doesn'tcontainavalidaliasconfigurationC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\node_modules\@angular\http\src\http_module.tsdoesn'texist.jsField'browser'doesn'tcontainavalidaliasconfigurationC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\node_modules\@angular\http\src\http_module.jsdoesn'texistasdirectoryC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\node_modules\@angular\http\src\http_moduledoesn'texistlookingformodulesinC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\srcusingdescriptionfile:C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\package.json(relativepath:./src)Field'browser'doesn'tcontainavalidaliasconfigurationafterusingdescriptionfile:C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\package.json(relativepath:./src)usingdescriptionfile:C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\package.json(relativepath:./src/@angular/http/src/http_module)noextensionField'browser'doesn'tcontainavalidaliasconfigurationC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\@angular\http\src\http_moduledoesn'texist.tsField'browser'doesn'tcontainavalidaliasconfigurationC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\@angular\http\src\http_module.tsdoesn'texist.jsField'browser'doesn'tcontainavalidaliasconfigurationC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\@angular\http\src\http_module.jsdoesn'texistasdirectoryC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\@angular\http\src\http_moduledoesn'texistlookingformodulesinC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\srcusingdescriptionfile:C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\package.json(relativepath:./src)Field'browser'doesn'tcontainavalidaliasconfigurationafterusingdescriptionfile:C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\package.json(relativepath:./src)usingdescriptionfile:C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\package.json(relativepath:./src/@angular/http/src/http_module)noextensionField'browser'doesn'tcontainavalidaliasconfigurationC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\@angular\http\src\http_moduledoesn'texist.tsField'browser'doesn'tcontainavalidaliasconfigurationC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\@angular\http\src\http_module.tsdoesn'texist.jsField'browser'doesn'tcontainavalidaliasconfigurationC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\@angular\http\src\http_module.jsdoesn'texistasdirectoryC:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\@angular\http\src\http_moduledoesn'texist[C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\app\node_modules][C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\node_modules][C:\Users\Wladimir\Desktop\projetocervejaria\node_modules][C:\Users\Wladimir\Desktop\node_modules][C:\Users\Wladimir\node_modules][C:\Users\node_modules][C:\node_modules][C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\node_modules\@angular\http\src\http_module][C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\node_modules\@angular\http\src\http_module.ts][C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\node_modules\@angular\http\src\http_module.js][C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\node_modules\@angular\http\src\http_module][C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\node_modules\@angular\http\src\http_module][C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\node_modules\@angular\http\src\http_module.ts][C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\node_modules\@angular\http\src\http_module.js][C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\node_modules\@angular\http\src\http_module][C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\@angular\http\src\http_module][C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\@angular\http\src\http_module.ts][C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\@angular\http\src\http_module.js][C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\@angular\http\src\http_module][C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\@angular\http\src\http_module][C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\@angular\http\src\http_module.ts][C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\@angular\http\src\http_module.js][C:\Users\Wladimir\Desktop\projetocervejaria\brewer-ui\src\@angular\http\src\http_module]@./src/app/app.module.ts17:0-59@./src/main.ts@multiwebpack-dev-server/client?http://0.0.0.0:0./src/main.ts
IbelievetheproblemisintheEstiloServicefile.
CouldsomeonecheckwhereIwentwrong?
Followingthesuggestionof@AndréRoggeriCampos
Imadethesuggestedchangesbutgeneratedthiserror:
ERRORinsrc/app/estilos/estilo.service.ts(2,10):errorTS2305:Module'"C:/Users/Wladimir/Desktop/projeto cervejaria/brewer-ui/node_modules/@angular/http/src/http_module"' has no exported member 'Http'.
It did not work!