Reputation: 13636
By click on button "push" I need to open new window and pass to it HTML content to display it.
Here is view that display HTML:
Here is controller definition:
var test = angular.module('test', []);
test.controller('testController', ['$compile', '$scope','$window', function($compile, $scope, $window) {
$scope.openWindow = function() {
$window.open('to-print', 'width=500,height=400');
};}]);
Here is HTML content:
<div ng-app="test" id = "content" ng-controller="testController">
<label>Entar Name:</label>
<label>Michael</label>
<br/>
<br/>
<label>Entar Age:</label>
<label>25</label>
<hr/>
<button ng-click="openWindow()">push!</button>
</div>
And the HTML I want to display inside opened window is:
<label>Entar Name:</label>
<label>Michael</label>
<br/>
<br/>
<label>Entar Age:</label>
<label>25</label>
Here is fiddle.
How can I implement it?
Upvotes: 1
Views: 2707
Reputation: 133
It's very simple... Add after
.open()
the following code
.document.write("Lorem Ipsum");
Here is a jsfiddle
Upvotes: 1
Reputation: 1861
You can include your content in documet.write() function
<script>
function myFunction() {
var myWindow = window.open("", "","width=600,height=100");
myWindow.document.write("<label>Entar Name:</label><label>Michael</label><br/><br/><label>Entar Age:</label><label>25</label>");
}
</script>
Upvotes: 2