javascript - Accessing Nested JSON with AngularJS -
i'm trying pull data behance.net , i'm running 2 issues when try information.
the first issue trying pull description of project. can information calling ng-bind="project.description"
formatting (paragraph returns) not present, i'm trying pull formatted description.
here html:
<div class="col-sm-6"> <h3 ng-bind="project.name"></h3> <p ng-bind="project.modules.text"></p> <h4><i class="fa fa-tags success"></i> tags</h4> <div class="row"> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> <div class="pull-left label label-info" style="margin-right:5px; margin-bottom:10px;" ng-repeat="tag in project.tags" ng-bind="tag"></div> </div> </div>
here json data behance showing:
angular.callbacks._0({ "project": { .... "modules": [{ "id": 111549713, "type": "text", "text": "this description of project trying get"
my second issue i'm guessing same first, here is.
<p style="margin-top:10px;" ng-bind="user.sections.about"></p>
and json file:
angular.callbacks._1({ "user": { "sections": { "about me": description used on behance website trying display
i can pull information except these 2 instances. appreciated.
first issue:
project.modules
array, try instead:
<p ng-bind="project.modules[0].text"></p>
second issue:
as property 'about me' contains space need use bracket notation access it:
<p style="margin-top:10px;" ng-bind="user.sections['about me']"></p>
Comments
Post a Comment