Create menu from a JSON file using AngularJS

-1

I have a JSON file with the following structure:

"[{\"Menu\":\"General/Register/User\"},
{\"Menu\":\"App/MultiExport/Parameter\"},
{\"Menu\":\"App/MultiExport/CreateFile\"},
{\"Menu\":\"App/MultiCube/Create\"}]"

How do I create a menu using AngularJS from this JSON?

Note that each "/" is a submenu level:

.General
      .Register
              .User
.App
      .MultiExport
              .Parameter
              .Create File
      .MultiCube
              .Create
    
asked by anonymous 17.11.2014 / 14:07

1 answer

0

Opa Lucas,

First it converts to a json, because the angle is thinking that it is a String and is putting these bars.

var novoJSON = angular.fromJson(objetoDoJson);

So you can play with the object and create the list you want.

The Javascript object looks like this:

[{Menu:"General/Register/User"},
{Menu:"App/MultiExport/Parameter"},
{Menu:"App/MultiExport/CreateFile"},
{Menu:"App/MultiCube/Create"}]
    
21.01.2015 / 16:10