加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

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

发布时间:2020-12-17 06:50:37 所属栏目:安全 来源:网络整理
导读:我想在角度JS指令中显示一个laravel刀片视图文件 var commentsApp = angular.module('CommentApp',[]);commentsApp.directive('commentForm',function(){ return { restrict: 'EA',replace: 'true' templateURL: 'views/comments/comment-form.blade.php' }}
我想在角度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'
    }
});

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读