How to Set Background image of div with ng-style

前端 未结 3 1563
离开以前
离开以前 2020-12-02 20:30

Basically i have a link, and when it\'s clicked, i display a modal. Now i can display other properties on the modal like title except the background Image ! urghhh !

3条回答
  •  感动是毒
    2020-12-02 20:51

    You have made some mistakes using single quotes, you have to take your variable outside the single quotes.

    For this div

    This part is being treated as a string

    'url({{selectedMeal.url}})'
    

    Whereas you would want angular to parse this variable

    {{selectedMeal.url}}
    

    So to solve this, the correct syntax is

提交回复
热议问题