0

I'm fairly new to AngularJS and I'm wanting to create a conditional display for if a file in my system has no attributes it will display "This file has no attributes"

My html is currently this:

<div>
    <br />                 
    <ul class="list-unstyled">
        <li ng-repeat="fileInfo in fileResources">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <span class="label label-default">{{fileInfo.DocType}}</span>
                    <span class="panel-title">{{fileInfo.Name}}</span>
                </div>
                <div class="panel-body">
                    <div class="panel panel-info" ng-if="fileInfo.fileAttributes">
                        <div class="panel-heading">file Attributes</div>
                        <div class="panel-body">
                        <ac-file-attributes
                            file-attributes="fileInfo.fileAttributes"
                            display-options="displayOptions">
                        </ac-file-attributes>
                        </div>
                    </div>

                    <div class="panel panel-info" ng-if="fileInfo.PhysicalProperties" >
                        <div class="panel-heading">Physical Properties</div>
                        <div class="panel-body">
                            <ac-physical-properties
                                phys-props="fileInfo.PhysicalProperties" 
                                display-options="displayOptions">
                            </ac-physical-properties>
                        </div>
                    </div>
                </div>

            </div>

        </li>
    </ul>
</div>
2
  • 3
    What is your question? Commented Sep 9, 2015 at 11:22
  • ng-if (add/remove DOM elements) or ng-show (hide/show elements). Commented Sep 9, 2015 at 11:26

1 Answer 1

1

if the above code already works, presumable you could use the following, which simply 'nots' the fileInfo.fileAttributes

<div class="panel panel-info" ng-if="!fileInfo.fileAttributes">
                    <div class="panel-heading">file Attributes</div>
                    <div class="panel-body">
                    <ac-file-attributes
                        file-attributes="fileInfo.fileAttributes"
                        display-options="displayOptions">
                    </ac-file-attributes>
                    </div>
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.