Angular 4 img src is not found

后端 未结 16 1580
我寻月下人不归
我寻月下人不归 2020-12-24 10:11

I\'m having a problem with sourcing an image with angular 4. It keeps telling me that the image is not found.

Folder structure:

app_folder/
app_compo         


        
16条回答
  •  情深已故
    2020-12-24 10:51

    Angular 4 to 8

    Either works

    
    
    {{imageAlt}}
    

    and the Component would be

    export class sample Component implements OnInit {
       imageSrc = 'assets/images/iphone.png'  
       imageAlt = 'iPhone'
    

    Tree structure:

    -> src 
       -> app
       -> assets
          -> images
               'iphone.png'
    

提交回复
热议问题