Here you go:
Changes are:
- Use
iframe
html tag to load webpage (that is in your tab)
- Use
$sce
service for using source URL of webpage in iframe
>
<!DOCTYPE html>
<html ng-app="blp_tabs">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular.min.js"></script>
<script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.10.0.js"></script>
<script>
angular.module('blp_tabs', ['ui.bootstrap']);
var TabsDemoCtrl = function ($scope, $sce) {
$scope.tabs = [
{ title:"Google", url:$sce.trustAsResourceUrl("http://www.google.com") },
{ title:"CNN", url:$sce.trustAsResourceUrl("http://www.cnn.com"), disabled: false }
];
$scope.navType = 'tabs';
};
</script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
</head>
<body >
<div ng-controller="TabsDemoCtrl">
<tabset >
<tab ng-repeat="tab in tabs" heading="{{tab.title}}" >
<iframe ng-src='{{tab.url}}' style="height:100%; width:100%;"></iframe>
</tab>
</tabset>
</div>
</body>
Edit 1 (To change the url of main page on tab click. I'm still not sure why someone will change url of main page after click operation on tab title. Hope you've some good reason for that):
<html ng-app="blp_tabs">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular.min.js"></script>
<script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.10.0.js"></script>
<script>
angular.module('blp_tabs', ['ui.bootstrap']);
var TabsDemoCtrl = function ($scope, $sce, $window, $log) {
$scope.tabs = [
{ title:"Google", url:$sce.trustAsResourceUrl("http://www.google.com") },
{ title:"CNN", url:$sce.trustAsResourceUrl("http://www.cnn.com"), disabled: false }
];
$scope.navType = 'tabs';
$scope.open = function(myUrl){
$window.location.href = myUrl;
}
};
</script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
</head>
<body >
<div ng-controller="TabsDemoCtrl">
<tabset >
<tab ng-repeat="tab in tabs" heading="{{tab.title}}" select='open(tab.url)'>
</tab>
</tabset>
</div>
</body>