Angular.js ng-switch ---testing if value is empty or undefined

前端 未结 3 2137
无人及你
无人及你 2021-02-12 11:48

In Angular.js templating, I need to test if a value is undefined or empty.... I am not sure how to do this since ng-switch-when tests for expressions in strings. I

3条回答
  •  猫巷女王i
    2021-02-12 12:23

    ng-switch allows expressions, you can use placeholder, as such:

    I am set to zero or undefined?! This string is not empty

    For more info: ng-switch on empty string

    You usually do it within controller(see answer#1 in linked thread).

提交回复
热议问题