我正在尝试生成一个 Twig 模板,它是通过 AngularJs 的模式。但是,我的模式没有显示,它只是调用出现在我的调试工具中的 404 请求(找不到“GET/en/admin/payments/views/viewServiceStatus”的路线。我不知道问题是什么是。这是 Angular 指令。
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'
最佳答案
尝试使用
`templateUrl: '/views/viewServiceStatus',`
而不是
`templateUrl: 'views/viewServiceStatus',`
希望这有帮助
关于php - 从 Angularjs 渲染 Twig 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52622957/