javascript - How to open browser wondow and pass HTML content? -


by click on button "push" need open new window , pass html content display it.

here view display html:

enter image description here

here controller defenition:

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 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 html want display inside opened window is:

<label>entar name:</label> <label>michael</label> <br/> <br/> <label>entar age:</label> <label>25</label> 

here fiddle.

how can implement it?

it's simple... add after

.open()

the following code

.document.write("lorem ipsum");

here jsfiddle


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -