Use Filter_angularjs in Angularjs Ng-style

Source: Internet
Author: User

Problem Reason:

Progress with boostrap in angular has problems with IE8 and cannot show progress

Wrong wording:

<div class= "Progress" >
  <div class= "Bar bar-success" style= "
     width:{{user.used | percent:user.total} } "></div></div>

This may be because the user's value has not been fetched when the page is first rendered, so the width is 0. The value of the user was later obtained, but the interface was not automatically updated.

The correct wording:

<div class= "Progress" >
  <div class= "Bar bar-success"
     ng-style= "{' Width ': (user.used | percent: user.total)} "></div>
</div>

Summarize

Because Ng-style is angular's own instructions, it listens for user changes and outputs the style attribute of the layer div, so it is correct.
Note that filter is used in Ng-style: (user.used | percent:user.total)

The above is the Angularjs Ng-style data collation, follow-up continue to supplement the relevant information, thank you for your support of this site!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.