DEV Community

Discussion on: Passing data between nested components with Angular

Collapse
 
danielfrugoni profile image
DanielFrugoni

Hi

No the path, the image I have in a json file

Thread Thread
 
chiangs profile image
Stephen Chiang

So if you've imported input like this:

import { component, input} from `@angular/core`

What does your HTML markup look like?

Thread Thread
 
danielfrugoni profile image
DanielFrugoni

Since I cant find the solution, Im trying to assign the Image to a global variable and then assign it to a local var

Thread Thread
 
danielfrugoni profile image
DanielFrugoni

Yes
@import() miImage: any;

Thread Thread
 
danielfrugoni profile image
DanielFrugoni

Im trying something differet like this

@Injectable()
export class Globals {
public imagenUno: any;
}

then:
this.globals.imagenUno=data.Imagen;
console.log('Foto:'+this.globals.imagenUno) (I see the image in conole.log)

then I have image.componet.ts
import { Globals } from 'src/app/globals';

constructor(private globals: Globals ) {
console.log('Foto:'+this.globals.imagenUno) (get Foto:undefined)
}

Well I guess Im missing something with angular 7