Angularjs + Symfony2 routing can't make it work

I am learning AngularJS and I would like to integrate it with my previous end of SF2. I am embarrassed with the routes, seeing that I have:

When we switch to / usermanager, the symfony routing system opens a controller that loads the branch template. In this template, I load all the js components needed for angular and do this:

 {% extends '::base.html.twig' %}

 {% block javascripts %}
    {{ parent() }}

    <script type="text/javascript" src="{{ asset('js/UserManager_Angular.js')}}"></script>
 {% endblock %}


 {% block body %}


<h1>User Manager</h1>

<div data-ng-view></div>
 {% endblock %}

Now this is my angular code:

   var UserManager = angular.module('UserManager', ['ngRoute','ngResource']);

UserManager.config(function($routeProvider){
   $routeProvider 
   .when('/addnew',
   {
       controller:'addNewController',
       templateUrl:Routing.generate('_UserManager_add_new_user')
   })
   .when('/',
   {
       controller:'UserManagerHome',
       templateUrl:Routing.generate('_UserManager_getUser_List')
   })

});

UserManager.factory('data_access',['$resource', 
    function($resource){
    return $resource(Routing.generate('_UserManager_getUserList'),{},{
        query:{method:'GET',isArray:true}
    });

}]);

UserManager.controller('UserManagerHome',function ($scope,data_access){
    $scope.users = data_access.query();    
    //$scope.orderProp = 'id';

});

ps: as you can see, I use FOSBundle to expose the js route. I think I got how to use this because my factory correctly gets users from the database.

So, I want to upload a file containing classic angular material, such as ng-repeatetc. This is represented in this way:

.when('/usermanager',
{
    controller:'UserManagerHome',
    templateUrl:Routing.generate('_UserManager_userList')
})

Here is my routing file:

_UserManager:
  pattern: /usermanager
  defaults: {_controller: AcmeBundle:UserManager:Home }
  options:
    expose: true

_UserManager_getUser_List:
  pattern: /usermanagerlist
  defaults: {_controller: NRtworksSubscriptionBundle:UserManager:list }
  options:
    expose: true  

_UserManager_getUserList:
  pattern: /usermanager/getuserlist
  defaults: {_controller: AcmeBundle:UserManager:getUserList }
  options:
    expose: true
  requirements:
    _format: json
    _method: GET    


_UserManager_add_new_user:
  pattern: /usermanager/addnew
  defaults : {_controller: AcmeBundle:AddNewUser:Home }
  options:
     expose: true

ps2: , , .

, /usermanager, " ". ?

0
1

angular . ,

 www.yoursite.com/usermanager

witch symfony/usermanager, angular    /

 www.yoursite.com/usermanager/#/usermanager

/usermanager.

, angular - Symfony, . angular #.

+3

Source: https://habr.com/ru/post/1568872/


All Articles