Question

This is the result returned from the POST calculation

  1. Here's the front end display and I've tried writing out {{calcs.@city}} which blows up with AngularJS errors so it doesn't appear to like the @ symbol.

         </div>
              <div class="col-sm-12">
                  <ul>
                     <li ng-repeat="calcs in calculations">
                            {{calcs}}
                      </li>
                   </ul>
               </div>
         </div>
    

How do I display the data with AngularJS since the response contains the '@' symbol as an attribute from the XML that is generated?

Was it helpful?

Solution

Use the square bracket notation:

<li ng-repeat="calcs in calculations">
  {{ calcs['@city'] }}
</li>

For clarity - this is essentially a Javascript issue. Square bracket notation allows access to properties containing special characters.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top