You have not registered modalDemoCtrl and ModalInstanceCtrl , first you need to register both controllers, for example: myApp.controller('modalDemoCtrl', ModalDemoCtrl); where myApp is an angular module, for example: var myApp = angular.module('plunker', ['ui.bootstrap']); .
you can use the service to retrieve data from the url using $http and this service in your modalInstance controller. in my example, create a dataService and a function called getData and this function is called from the modalInstance controller. for example: dataService.getData().then(.. and use the function to get the response. and save the response data in the $scope.infos variable so you can use this $scope.infos in your modal format.
var myApp = angular.module('plunker', ['ui.bootstrap']); var ModalDemoCtrl = function ($scope, $modal, $log) { $scope.open = function () { var modalInstance = $modal.open({ templateUrl: 'myModalContent.html', controller: ModalInstanceCtrl, resolve: { items: function () { return $scope.items; } } }); }; }; myApp.controller('modalDemoCtrl', ModalDemoCtrl); myApp.factory('dataService', function($http) { return { getData: function() { return $http.get('http://prnt.sc/ashi5e'); } }; }); var ModalInstanceCtrl = function ($scope, $modalInstance, items, dataService) { dataService.getData().then(function(response) { $scope.infos = response.data; }); $scope.cancel = function () { $modalInstance.dismiss('cancel'); }; }; myApp.controller('ModalInstanceCtrl', ModalInstanceCtrl);
source share