从Angularjs重新渲染树枝模板

时间:2018-10-03 08:37:16

标签: php angularjs symfony twig

我正在尝试生成一个树枝模板,该模板是AngularJs的模态。但是,我的模态没有显示,它只是要求在我的调试工具中显示一个404请求(找不到“ GET / en / admin / payments / views / viewServiceStatus”的路由。我不知道是什么问题是。这是角度指令。

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',
 };
}]);

这是我的route.yaml文件

acme_bundle_service_status:
path: views/viewServiceStatus
defaults:
    _controller: FrameworkBundle:Template:template
    template:    '@PaymentBundle/Resources/views/Admin/Payment/viewServiceStatus.html.twig'

1 个答案:

答案 0 :(得分:2)

尝试

`templateUrl: '/views/viewServiceStatus',`

代替

`templateUrl: 'views/viewServiceStatus',`

希望获得帮助

相关问题