0
Watch my Angular Front-end project
Now watch my Back-end Java project with Spring Boot
Don’t worry about my Back-end project, it’s working well, the problem is my Angular Front-end project, I’m trying to load a grid and I’m not succeeding because it’s generating an error in the Angular consoles, but rather look at the files I changed.
See my project running before the changes:
app.modules.ts file Before:
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
EstilosModule,
CoreModule,
CevejasModule,
ClientesModule,
UsuariosModule,
BrowserAnimationsModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
After the changes:
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
EstilosModule,
CoreModule,
CevejasModule,
ClientesModule,
UsuariosModule,
HttpModule,
BrowserAnimationsModule
],
providers: [EstiloService],
bootstrap: [AppComponent]
})
export class AppModule { }
Stilopesquisacomponent file Before:
export class EstiloPesquisaComponent {
}
After the changes:
export class EstiloPesquisaComponent implements OnInit{
estilos = [];
constructor(private estiloService: EstiloService){ }
ngOnInit() {
this.pesquisar();
}
pesquisar() {
this.estiloService.pesquisar()
.then(estilos => this.estilos = estilos);
}
}
I think my problem is in this code below:
Arquivo Stiloservice
Before:
@Injectable()
export class EstiloService {
}
After the changes:
@Injectable()
export class EstiloService {
estilosUrl = 'http://localhost:8080/estilos';
constructor(private http: Http) { }
pesquisar(): Promise<any> {
return this.http.get(`${this.estilosUrl}`)
.toPromise()
.then(response => {
console.log(response.json());
});
}
}
After I make the changes it generates this error:
ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve '@angular/http/src/http_module' in 'C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\app'
resolve '@angular/http/src/http_module' in 'C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\app'
Parsed request is a module
using description file: C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\package.json (relative path: ./src/app)
Field 'browser' doesn't contain a valid alias configuration
after using description file: C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\package.json (relative path: ./src/app)
resolve as module
C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\app\node_modules doesn't exist or is not a directory
C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\node_modules doesn't exist or is not a directory
C:\Users\Wladimir\Desktop\projeto cervejaria\node_modules doesn't exist or is not a directory
C:\Users\Wladimir\Desktop\node_modules doesn't exist or is not a directory
C:\Users\Wladimir\node_modules doesn't exist or is not a directory
C:\Users\node_modules doesn't exist or is not a directory
C:\node_modules doesn't exist or is not a directory
looking for modules in C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\node_modules
using description file: C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
after using description file: C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\package.json (relative path: ./node_modules)
using description file: C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\node_modules\@angular\http\package.json (relative path: ./src/http_module)
no extension
Field 'browser' doesn't contain a valid alias configuration
C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\node_modules\@angular\http\src\http_module doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\node_modules\@angular\http\src\http_module.ts doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\node_modules\@angular\http\src\http_module.js doesn't exist
as directory
C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\node_modules\@angular\http\src\http_module doesn't exist
looking for modules in C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\node_modules
using description file: C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
after using description file: C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\package.json (relative path: ./node_modules)
using description file: C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\node_modules\@angular\http\package.json (relative path: ./src/http_module)
no extension
Field 'browser' doesn't contain a valid alias configuration
C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\node_modules\@angular\http\src\http_module doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\node_modules\@angular\http\src\http_module.ts doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\node_modules\@angular\http\src\http_module.js doesn't exist
as directory
C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\node_modules\@angular\http\src\http_module doesn't exist
looking for modules in C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src
using description file: C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\package.json (relative path: ./src)
Field 'browser' doesn't contain a valid alias configuration
after using description file: C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\package.json (relative path: ./src)
using description file: C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\package.json (relative path: ./src/@angular/http/src/http_module)
no extension
Field 'browser' doesn't contain a valid alias configuration
C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\@angular\http\src\http_module doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\@angular\http\src\http_module.ts doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\@angular\http\src\http_module.js doesn't exist
as directory
C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\@angular\http\src\http_module doesn't exist
looking for modules in C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src
using description file: C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\package.json (relative path: ./src)
Field 'browser' doesn't contain a valid alias configuration
after using description file: C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\package.json (relative path: ./src)
using description file: C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\package.json (relative path: ./src/@angular/http/src/http_module)
no extension
Field 'browser' doesn't contain a valid alias configuration
C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\@angular\http\src\http_module doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\@angular\http\src\http_module.ts doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\@angular\http\src\http_module.js doesn't exist
as directory
C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\@angular\http\src\http_module doesn't exist
[C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\app\node_modules]
[C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\node_modules]
[C:\Users\Wladimir\Desktop\projeto cervejaria\node_modules]
[C:\Users\Wladimir\Desktop\node_modules]
[C:\Users\Wladimir\node_modules]
[C:\Users\node_modules]
[C:\node_modules]
[C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\node_modules\@angular\http\src\http_module]
[C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\node_modules\@angular\http\src\http_module.ts]
[C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\node_modules\@angular\http\src\http_module.js]
[C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\node_modules\@angular\http\src\http_module]
[C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\node_modules\@angular\http\src\http_module]
[C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\node_modules\@angular\http\src\http_module.ts]
[C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\node_modules\@angular\http\src\http_module.js]
[C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\node_modules\@angular\http\src\http_module]
[C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\@angular\http\src\http_module]
[C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\@angular\http\src\http_module.ts]
[C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\@angular\http\src\http_module.js]
[C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\@angular\http\src\http_module]
[C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\@angular\http\src\http_module]
[C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\@angular\http\src\http_module.ts]
[C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\@angular\http\src\http_module.js]
[C:\Users\Wladimir\Desktop\projeto cervejaria\brewer-ui\src\@angular\http\src\http_module]
@ ./src/app/app.module.ts 17:0-59
@ ./src/main.ts
@ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
I believe the problem is in the file Stiloservice.
Could someone check where I went wrong please?
Following the suggestion of @André Roggeri Campos
made the suggested changes, but generated this error:
ERROR in src/app/estilos/estilo.service.ts(2,10): error TS2305: Module '"C:/Users/Wladimir/Desktop/projeto cervejaria/brewer-ui/node_modules/@angular/http/src/http_module"' has no exported member 'Http'.
didn’t work!
gave a different error, I think the problem is not the import.
– wladyband
if you check this github model and design it did the same import 

– wladyband
fix the problem, the problem was importing the module file, I switched this import { Httpmodule } from '@angular/http/src/http_module'; import { Httpmodule } from '@angular/http'; but anyway your tip helped, thank you very much.
– wladyband