I want to open a modal popup with angular, and have it open the Url that I passed as parameter. I can't figure out how to open the url inside the modal popup window. This is what I have so far:
($scope.targetUrl
would be for example "http://www.google.de")
var modalWindowOptions = {
templateUrl: 'app/modal.tpl.html',
controller: function($scope, $modalInstance, targetUrl) {
$scope.init = function() {
console.log(platformUrl);
}
},
resolve: {
targetUrl: function () {
return $scope.targetUrl;
}
}
};
$modal.open(modalWindowOptions)
.result.then(onPopupClose, onPopupClose, onPopupClose);
function onPopupClose() {
console.log('closed popup!');
};
and the template:
<div data-ng-init="init()" style="width:500px; height: 600px;">
<p ng-bind="targetUrl"></p>
</div>
What should I do in the init
function? I tried everything possible for at least 6 hours now, $location
, etc etc. I expected this to work easily just like window.open(url)
, but I'm missing something. Thanks