Pregunta

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?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top