2

I'm trying to generate a twig template which is a modal through AngularJs. But, my modal doesn't show up, it just calls for a 404 request that appears in my debug tool (No route found for "GET /en/admin/payments/views/viewServiceStatus". I don't know what the problem is. This is the angular directive.

app.directive('viewServiceStatus', [function() {
return {
restrict: 'E',
scope: {
  model: '=',
},
link: function(scope, element, attributes) {
  scope.$watch('model.visible', function(newValue) {
    var modalElement = element.find('.modal');
    modalElement.modal(newValue ? 'show' : 'hide');
  });

  element.on('shown.bs.modal', function() {
    scope.$apply(function() {
      scope.model.visible = true;
    });
  });

  element.on('hidden.bs.modal', function() {
    scope.$apply(function() {
      scope.model.visible = false;
    });
  });

},
templateUrl: 'views/viewServiceStatus',
 };
}]);

This is my route.yaml file

acme_bundle_service_status:
path: views/viewServiceStatus
defaults:
    _controller: FrameworkBundle:Template:template
    template:    '@PaymentBundle/Resources/views/Admin/Payment/viewServiceStatus.html.twig'
Matteo
  • 37,680
  • 11
  • 100
  • 115
brokleyscoding
  • 187
  • 3
  • 12

1 Answers1

2

try with

`templateUrl: '/views/viewServiceStatus',`

instead of

`templateUrl: 'views/viewServiceStatus',`

Hope this help

Matteo
  • 37,680
  • 11
  • 100
  • 115