Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

As fotos não carregam em localhost:4200/user/flavio

As fotos não carregam em localhost:4200/user/flavio

e aparece a mensagem de erro:

core.js:1673 ERROR DOMException: Failed to execute 'open' on 'XMLHttpRequest': Invalid URL
    at http://localhost:4200/polyfills.js:15598:31
    at XMLHttpRequest.proto.<computed> [as open] (http://localhost:4200/polyfills.js:13909:24)
    at Observable._subscribe (http://localhost:4200/vendor.js:7374:17)
    at Observable.push../node_modules/rxjs/_esm5/internal/Observable.js.Observable.subscribe (http://localhost:4200/vendor.js:61189:69)
    at http://localhost:4200/vendor.js:77653:31
    at subscribeToResult (http://localhost:4200/vendor.js:77836:84)
    at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapSubscriber._innerSub (http://localhost:4200/vendor.js:70655:99)
    at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapSubscriber._tryNext (http://localhost:4200/vendor.js:70652:14)
    at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapSubscriber._next (http://localhost:4200/vendor.js:70635:18)
    at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (http://localhost:4200/vendor.js:61979:18)
2 respostas

Oi, Clairton, tudo bem?

Você poderia compartilhar como está o seu app.routing.modules.ts? para que ver e entender o que possa ter acontecido para gerar esse erro.

solução!
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

import { PhotoListComponent } from './photos/photo-list/photo-list.component';
import { PhotoFormComponent } from './photos/photo-form/photo-form.component';
import { NotFoundComponent } from './errors/not-found/not-found.component';

const routes: Routes = [
    { path: 'user/:userName', component: PhotoListComponent },
    { path: 'p/add', component: PhotoFormComponent },
    { path: '""', component: NotFoundComponent }
];

@NgModule({
  imports: [ RouterModule.forRoot(routes) ],
  exports: [ RouterModule ]
})
export class AppRoutingModule { }