вот мое приложение, пытаясь использовать модальный интерфейс, но когда модальная функция не может найти html-шаблон. я могу настроить консоль внутри функции, но не могу открыть модальное представление.My Angular ui modal can not find the template
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>
и это то, что я получаю:
GET http://localhost:63342/views/modal.html 404 (Not Found)
путь является 100% правильно, так что если у ребят может видеть то, что есть проблема.
Если вы перейдете непосредственно к http: // localhost: 63342/views/modal.html в своем браузере, он натягивает шаблон вверх? – duhseekoh
Нет, это корень: mainFolder -> views -> modal.html и index.html в mainFolder –
Правильно .. Так что путь неправильный. Что относительно '' 'templateUrl: 'yourmainfolder/views/modal.html''''? – duhseekoh