Javascript 我的用户界面找不到模板

Javascript 我的用户界面找不到模板,javascript,angularjs,angular-ui,angular-ui-bootstrap,Javascript,Angularjs,Angular Ui,Angular Ui Bootstrap,这是我的应用程序,尝试使用UI模式,但当模式函数找不到html模板时。我可以在函数内部控制台日志,但无法打开模式视图 var app = angular.module('myApp', [ 'angularUtils.directives.dirPagination', 'ui.bootstrap' ]); app.controller('galleryCtrl', ['$scope', '$http', function ($scope, $ht

这是我的应用程序,尝试使用UI模式,但当模式函数找不到html模板时。我可以在函数内部控制台日志,但无法打开模式视图

 var app = angular.module('myApp', [
        'angularUtils.directives.dirPagination',

    'ui.bootstrap'
    ]);


    app.controller('galleryCtrl', ['$scope', '$http', function ($scope, $http) {

    }]).
    controller('ModalInstanceCtrl',['$scope','$modal',function($scope, $modalInstance){

    }]).
    directive('myGallery', function ($http,$modal) {
        return {
            restrict: 'E',
            scope: {
                feed: '@',
                search: '=?',
                resultsPerPage: "=?",
                sorting: "=?"
            },
            templateUrl: './MyGallery.tpl.html',
            link: function (scope, element, attrs) {


                scope.search = scope.search || true;
                scope.sorting = scope.sorting || true;
                scope.resultsPerPage = scope.resultsPerPage || 10;

                console.log(scope.resultsPerPage);

                scope.openModal = function() {


                    var modalInstance = $modal.open({
                        templateUrl: '/views/modal.html',
                        controller: 'ModalInstanceCtrl'
                    });
                };
在html中:

<div class="imgs">
    <ul>
        <li dir-paginate="img in imgs
        | filter:query
        | itemsPerPage: resultsPerPage.value || 10 ">
               <a href=""><img ng-src="{{img.url}}" ng-click="openModal()"></a>
        </li>
    </ul>
</div>

路径是100%正确的,所以如果你们能看到问题所在。

只是为了确保。。尝试:

templateUrl: 'views/modal.html',
可能您的本地服务器的文档根不是您认为的位置


去掉初始斜杠,确保路径与角度项目的根文件夹相对。

如果直接在浏览器中转到,它会将模板拉上来?不,这是根:main folder->views->modal.html和main folder中的index.html。。所以路径是不正确的。关于templateUrl:'yourmainfolder/views/modal.html'?我得到这个,但没有找到/:get 404,我根本不知道这个根。有什么想法吗?您必须将服务器根配置为angular项目的根。
templateUrl: 'views/modal.html',