我想在Angular JS指令中显示laravel Blade View 文件
var commentsApp = angular.module('CommentApp',[]);
commentsApp.directive('commentForm',function(){
return {
restrict: 'EA',
replace: 'true'
templateURL: 'views/comments/comment-form.blade.php'
}
});
我想通过 Angular 指令而不是使用
@include('comments.comment-form')
我的问题在哪里?如何解决这个问题。谢谢你。
最佳答案
首先,您必须在laravel中定义一条路线
Route::get('comment-form', function() {
return view('comments.comment-form');
});
然后您可以在AngularJS中使用它
var commentsApp = angular.module('CommentApp', []);
commentsApp.directive('commentForm', function() {
return {
restrict: 'EA',
replace: 'true',
templateURL: 'comment-form'
}
});
关于angularjs - 我如何在templateURL中使用Angular JS使用Laravel局部 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29621048/