search

Home  >  Q&A  >  body text

javascript - If I write {{data binding}} in the style, will the appearance style be automatically refreshed immediately when the data changes? Should I use style or ng-style?

<p style="background-size: 34px {{data.height}}px;">

If you write data binding in the style, will the appearance style be automatically refreshed immediately when the data ($scope.data.height) changes? Should I use style or ng-style at this time? What's the difference between the two? Does ng-style have the effect of making the appearance style respond immediately to data changes?

天蓬老师天蓬老师2750 days ago698

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师2017-05-17 09:58:53

    <h1 ng-style='{    "color" : "white",
        "background-color" : "coral",
        "font-size" : "60px",
        "padding" : "50px"
      }'>教程</h1>
      
      用框架就乖乖的按着他提供的东西去用

    reply
    0
  • Cancelreply