angularjs – 如何在templateURL中使用角度js的laravel局部视图

前端之家收集整理的这篇文章主要介绍了angularjs – 如何在templateURL中使用角度js的laravel局部视图前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在角度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'
    }
});

猜你在找的Angularjs相关文章