AngularJs Laravel5.2 中的指令 templateURL

AngularJs directive templateURL in Laravel5.2

我想在我的 laravel 项目 中使用 angular 指令。但是当我尝试调用我的 angular 指令时,找不到 Angular 指令 的 tempateUrl。我的代码如下:

html

 <demographich-url></demographich-url>

JS

 .directive('demographichUrl', [function () {
        return {
            restrict: 'EA',
            replace: true,
            templateUrl: 'demographich', // this doesn't work
            // 'templateUrl: './views/comments/comment-form.html', // this doesn't work
           // 'templateUrl: './views/comments/comment-form.blade.php', // this doesn't work
            // template:'<h1> hello world! </h1>',  // this works
        };
    }])

Laravel 路线

   // routes
  Route::get('demographich', 'CompanyController@demographich');


   // controller
    public function demographich()
   {
       return view('comments.comment-form');
   }

** 评论-form.blade.php(templateUrl 页面[未找到该页面])**

    <h1> Hi your comments goes here!!!!  </h1>

** 我的文件结构 **

 |
 | ---  resources
        | --- views
              | -- comments
                    | -- comment-form.blade.php

注意: Laravel : 5.2 Angular: 1.5.X

我已经使用下面的指令代码解决了这个问题。

.directive('demographichUrl', function () {
    return {
        restrict: 'EA',
        scope: {
            obj: '=',
            submitFunc: '&'
        },
        templateUrl:  '<?= asset('app/directive/demograph/demographich.html') ?>',
        link: function (scope, iElement, iAttrs) {

        }
    };
})

您可以在指令中使用 laravel blade 页面..

.directive('surveyHeader', function () {
    return {
        restrict: 'EA',
        scope: {
            obj: '=',
            submitSurveyheader: '&'
        },
        templateUrl:  '<?php echo asset('app/directive/surveyheader/surveyheader.blade.php') ?>',

        link: function (scope, iElement, iAttrs) {

        }
    };
})