how to convert text in json to angular and how to loop on the board

advertisements

Am new to Angularjs, any one can help me about this infact my array is like this

array = [{"loc_name":"pronto network office","address":"3rd floor, kalyani motors","ap":[]}],

but when i use at dynamically its converted like this

[" {\"loc_name\":\"pronto="" network="" office\",\"address\":\"3rd="" floor,="" kalyani="" motors\",\"ap\":[]}"]

finally i want like this

<ul ng-repeat="loc in [" {\"loc_name\":\"pronto=" " network=" " office\",\"address\":\"3rd=" " floor,=" " kalyani=" " motors\",\"ap\":[]} "]"="">
    <li class="clearfix">
        <div class="list-icon">
            <i class="fa fa-user"></i>
        </div>
        <div class="location-info">
            <h4 class="location-name">{{ loc.loc_name }}</h4>
            <p class="location-address">{{ loc.address }}</p>
        </div>
    </li>
    <li ng-if="loc.aps != '' ">
        <ul ng-repeat="ap in loc.aps">
            <li class="clearfix">
                <div class="list-icon">
                    <i class="fa fa-user"></i>
                </div>
                <div class="location-info">
                    <h4 class="location-name">{{ ap.mac_id }}</h4>
                    <p class="location-address"></p>
                </div>
            </li>
        </ul>
    </li>
</ul>


Your response should not contain " at starting of object inside array right after [ and just before ] need to remove " like it should be like [{\"loc_name\":\"pronto="" network="" office\",\"address\":\"3rd="" floor,="" kalyani="" motors\",\"ap\":[]}]

Then place it in your scope variable $scope.locations = [{\"loc_name\":\"pronto="" network="" office\",\"address\":\"3rd="" floor,="" kalyani="" motors\",\"ap\":[]}] & refer that scope variable on html then you need to worry about to convert it to double quote" to '`' single quote.

<ul ng-repeat="loc in locations">
  ...
<ul>