javascript - A question about ng-bind in angular
扔个三星炸死你
扔个三星炸死你 2017-06-17 09:15:39
0
3
818

There is such a piece of code in the project. span is bound to freezerDoorStatus. Two of the values are true and one is false. The class of p can be changed according to the boolean value, but true and false will always be displayed in the span. Is there any way to not display it or display it as a switch?

扔个三星炸死你
扔个三星炸死你

reply all (3)
大家讲道理

I still don’t quite understand your specific needs. See if it helps you
Use ng-show="isOpen" or ng-if="isOpen"
Then the controller can assign the value of $Scope.isOpen to true or false

    淡淡烟草味

    ng-bindis equivalent to the replacement expression method{}, for example:

    is equivalent to
    { { someValue }}

    If you need to control the style, you need to useng-class,ng-style. If you need to control the display, useng-iforng-show, for example:

      我想大声告诉你

      The above describes the correct use of ng-bind, that is, is equivalent to {{freezerDoorStatus}}.
      But when setting the style You can use ng-style or ng-class to control whether the style is displayed based on the value of the variable (true/false).
      You can use

      or use ng-style, as follows

      .
      You can go to angular official website https://docs.angularjs.org/ap... for detailed introduction.

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!