Skip to content

Commit a7aad5a

Browse files
committed
Only load iframe if URL variable exists
1 parent 3f2dba6 commit a7aad5a

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

webroot/js/scripts/directives/IframeDirective.js

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,42 @@
1-
angular.module('openITCOCKPIT').directive('iframeDirective', function($sce){
1+
/*
2+
* Copyright (C) <2015-present> <it-novum GmbH>
3+
*
4+
* This file is dual licensed
5+
*
6+
* 1.
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, version 3 of the License.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*
19+
* 2.
20+
* If you purchased an openITCOCKPIT Enterprise Edition you can use this file
21+
* under the terms of the openITCOCKPIT Enterprise Edition license agreement.
22+
* License agreement and license key will be shipped with the order
23+
* confirmation.
24+
*/
25+
26+
angular.module('openITCOCKPIT').directive('iframeDirective', function($sce) {
227
return {
328
restrict: 'E',
4-
template: '<iframe src="{{trustedUrl}}" onload="this.height=(screen.height+15);" width="100%" frameborder="0"></iframe>',
29+
template: '<iframe ng-if="trustedUrl" src="{{trustedUrl}}" onload="this.height=(screen.height+15);" width="100%" frameborder="0"></iframe>',
530
scope: {
631
'url': '='
732
},
833

9-
controller: function($scope){
34+
controller: function($scope) {
1035

1136
},
1237

13-
link: function($scope, element, attr){
14-
$scope.$watch('url', function(){
38+
link: function($scope, element, attr) {
39+
$scope.$watch('url', function() {
1540
$scope.trustedUrl = $sce.trustAsResourceUrl($scope.url);
1641
});
1742
}

0 commit comments

Comments
 (0)