user2816085 user2816085 - 1 year ago 61
AngularJS Question

Angular, ng-repeat not working in same paragraph

I am trying to use

inside a paragraph
tag. But it is not working.
Below is my code:

<div class="section">
<p class="text-left">
<strong>Company:</strong> &nbsp;{{showData.Company}}&nbsp;&nbsp;
<b ng-repeat="location in showData.City">Location:</b>&nbsp;{{location}}</p>

However if I wish to implement
in next paragraph it is working. But I want entire things to be in one line. Any suggestion, why it is not working and how should I put
in above code.

**Edit: **I tried below code from one answer

<b ng-repeat="location in showData.City">Location: {{location}}</b>

However it is causing two problems


I expect result to be like Location: Banglore, India

while it is giving Location: Banglore, Location: India

Second I don't want my value to be in bold letters.

Answer Source
<div class="section">
    <p class="text-left">
        <strong>Company:</strong> &nbsp;{{showData.Company}}
        Location: <span ng-repeat="location in showData.City">{{location}}</span>

If you need to show the cities, you can just join the entries in your controller and show them:

this.citiesJoined = showData.City.join(",");


Location: Location: {{citiesJoined}}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download