Update
You can simply use jQuery to hide the other elements except the element with ID needToDisplayThis like this:
$(document).ready(function(){
var elemToShow = $('#needToDisplayThis');
$('body').html('<div><h1>'+elemToShow.html()+'</h1></div>');
});
Firstly, your ng-include myTable.html should not contain the <html><head></head><body></body></html>
tags. Use only the markup that you want to render, ie: <div> test<h1 id="needToDispalythis">ds,<span>something</span></h1></div>
.
So your main html should look like this:
<html>
<head>this is head</head>
<body>
<div ng-app="myApp" ng-controller="customersCtrl">
<div ng-include="'myTable.htm'"></div>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
});
</script>
</body>
</html>
And your included html should look like this:
<div>
<span>test</span>
<h1 id="needToDispalythis">ds,<span>something</span></h1>
</div>
Now to only show the <h1>
element you need to hide the <span>
element, so add an ng-hide
attribute to that:
<span ng-hide="hideThis">test<span/>
Now simply set the hideThis variable on the $scope
to true:
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$scope.hideThis = true;
});
</script>
So finally, your main html looks like this:
<html>
<head>this is head</head>
<body>
<div ng-app="myApp" ng-controller="customersCtrl">
<div ng-include="'myTable.htm'"></div>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$scope.hideThis = true;
});
</script>
</body>
</html>
and your myTable.html looks like this:
<div>
<span ng-hide="hideThis">test<span/>
<h1>ds,<span>something</span></h1>
</div>