0

I'm trying to fetch some data from a json using angular. This is the json structure:

{
   "@rid":"#12:0",
   "@version":2,
   "@class":"Node",
   "name":"1",
   "childs":[
      {
         "@rid":"#11:2",
         "@version":1,
         "@class":"Link",
         "name":"1.4.5 --> 1.5.2.2.1",
         "parent":"#12:0",
         "from":"#12:61",
         "to":"#12:24"
      },
      {
         "@rid":"#11:3",
         "@version":0,
         "@class":"Link",
         "name":"1.5.2 --> 1.2.4",
         "parent":"#12:0",
         "from":"#12:17",
         "to":"#12:137"
      },

and so on.. Here I'm fetching data:

$http.get('nodes/nodes.json').success(function(data){
$scope.nodes = data;
});

And then I try to print:

<li class="node-children" ng-repeat="node in $parent.node.childs">
    <a ng-href="#" ng-click="">{{node.['@rid']}}</a>
</li>

But it doesn't work. I also tryied {{node.["@rid"]}} but it's still not working. How can I escape @ symbol while fetching json?

Thanks

1 Answer 1

2

Either you use the dot notation to access a field, or you use the array notation. But not both. It should be

{{ node['@rid'] }}

or

{{ node["@rid"] }}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.