jucasoft / angular-routing-app

angular-routing-app
0 stars 6 forks source link

primo commit in errore #1

Open Alex7-tr opened 3 years ago

Alex7-tr commented 3 years ago

Ciao Luca, ho pushato e committato al primo errore come mi hai suggerito.

attendo tue notizie

jucasoft commented 3 years ago

nel file: app-routing.module.ts mancano gli import dei componenti:

import {FirstComponent} from './first/first.component';
import {SecondComponent} from './second/second.component';
import {PageNotFoundComponent} from './page-not-found/page-not-found.component';

se non importi una classe non puoi utilizzarla, lo esige typescript: https://www.typescriptlang.org/docs/handbook/modules.html

sempre nel file: app-routing.module.ts fia uso del componente: PageNotFoundComponent non trovo traccia di questo componente, devi crearlo.

nel file: app.module.ts devi aggiungere i componenti che hai creato nell'attributo 'declarations':

...
@NgModule({
  declarations: [ 
    AppComponent,
    PageNotFoundComponent,
    FirstComponent,
    SecondComponent
  ],
  ...

facciamo chiarezza (almeno proviamoci): i componenti sono

import { AppComponent } from './app.component'; // <<=== IMPORTAZIONE CLASSE

@NgModule({ declarations: [AppComponent], // <<== DICHIARAZIONE COMPONENTE imports: [BrowserModule], providers: [], bootstrap: [AppComponent] }) export class AppModule {}


ora passiamo ad errori presenti neI file FirstComponent E SecondComponent:

... export class ???????? implements OnInit {

name; // <=== MANCA QUESTO ATTRIBUTO .... ngOnInit(): void { this.route.queryParams.subscribe(params => { this.name = params['name']; // <=== IN QUESTO PUNTO NE FAI USO }); }

} ...


dopo averli corretti controlla nel tutorial dove venivano indicati questi passaggi.

fai sapere.
Alex7-tr commented 3 years ago

ciao luca, ho provveduto alla correzione. spero sia corretto (non ho trovato l'attributo "name" che mi serve).

jucasoft commented 3 years ago

ciao, l'atributo "name" avresti dovuto crearlo. quindi ti funziona tutto?

Alex7-tr commented 3 years ago

ah ok...pensavo dovessi trovarlo anche nel codice del tutorial. si non mi da errori.