i would load my menù from json file and add routing dynamically; i try this code but don't work: When I loading this menu..i would to create dynamic routing with ui-routing of angularjs; Thank's in Advanced. Marco.
setup.js.php
<?php
session_start();
$menu = file_get_contents("layout/menu/mymenu.json");
header("content-type: application/javascript");
?>
angular.module('erp.Setup', []).constant('Setup', {
username: '<?php print USER_NAME; ?>',
menu: '<?php print $menu; ?>' <---- Uncaught SyntaxError: Unexpected token ILLEGAL
});
My json:
{
"menu": {
"_id": "menu_1",
"item": [
{
"title": "Test item1",
"subtit": "Subtitle 1",
"color": "red",
"icon": "fa-menu",
"link": "#/m_item1"
}
]
}
}