我想在角度JS指令中显示一个laravel刀片视图文件
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形式’)
我的问题在哪里?怎么解决这个问题.
谢谢.
解决方法
首先,您必须在laravel中定义路线
Route::get('comment-form',function() { return view('comments.comment-form'); });
然后你可以在AngularJS中使用它
var commentsApp = angular.module('CommentApp',function() { return { restrict: 'EA',replace: 'true',templateURL: 'comment-form' } });