Check if Array is empty Ng-Switch

1

I check a parameter with an array that can have values it or not. I have a Ng-Switch does a check in this array. I would like it when it had no value to display a Message.

I've done ng-switch-when="" but it did not work and I do not know if it's the right thing.

<div ng-repeat="p in ctrl.currentreport.parameters" ng-switch="p.dataType">
                        <div ng-switch-when="">
                            Não há dados
                        </div>
                        <div ng-switch-when="Integer">
                            <reportinteger parameter="p"></reportinteger>
                        </div>
                        <div ng-switch-when="DateTime">
                            <reportdate parameter="p"></reportdate>
                        </div>
                        <div ng-switch-when="Boolean">
                            <reportboolean parameter="p"></reportboolean>
                        </div>
                    </div>
    
asked by anonymous 20.04.2016 / 16:46

2 answers

1

Use

<div ng-switch-default>

           Alguma coisa...   
 </div>
    
24.04.2016 / 18:14
1
<div ng-repeat="p in ctrl.currentreport.parameters">
                        <div ng-if="!p.dataType">
                            Não tem dados
                        </div>
                        <div ng-if="p.dataType">
                            <div ng-switch="p.dataType">
                                <div ng-switch-when="Integer">
                                    <reportinteger parameter="p"></reportinteger>
                                </div>
                                <div ng-switch-when="DateTime">
                                    <reportdate parameter="p"></reportdate>
                                </div>
                                <div ng-switch-when="Boolean">
                                    <reportboolean parameter="p"></reportboolean>
                                </div>
                                <div ng-switch-when="String">
                                    <reportstring parameter="p"></reportstring>
                                </div>
                            </div>
                        </div>
                    </div>
    
26.04.2016 / 15:02