Injecting Laravel 5.7 dompdf with angularjs, how to call the print route from laravel in angularjs
I don't understand how to call the correct route of laravel 5.7 from angularjs to print that route data. I have showed data on a view from laravel and when I go to that route from laravel route then I can print the data but when I try to open that route from angularjs using ui-router or simply calling my laravel route inside angularjs then I am not redirecting to that print page. My actual question is that how to go to laravel route from angularjs to print that data. And I am using dompdf. Here is my code
Here is my route
Route::get('quotationInvoice','QuotationController@getQuoteInvoice');
Here is my laravel controller
public function getQuoteInvoice()
{
$id = $this->getQuoteID();
$data1 = quotationGridModel::find($id)->customer()->get();
$data2 = quotationGridModel::where('QUOTE_ID',$id)->get();
$pdf = PDF::loadView('printinvoice',['data1'=>$data1,'data2'=>$data2]);
return $pdf->stream('invoice.pdf');
}
when I write quotationInvoice
in browser it gives me the print data, but how can I use this route in angularjs to get the job done. I have applied many methods like angularjs ui.router, window.assign(url);
etc but really don't understand. And in my full project I have used angularjs ui.router. Can anyone help me to do this work. Thanks in advanced.
angularjs angular-ui-router laravel-5.7
add a comment |
I don't understand how to call the correct route of laravel 5.7 from angularjs to print that route data. I have showed data on a view from laravel and when I go to that route from laravel route then I can print the data but when I try to open that route from angularjs using ui-router or simply calling my laravel route inside angularjs then I am not redirecting to that print page. My actual question is that how to go to laravel route from angularjs to print that data. And I am using dompdf. Here is my code
Here is my route
Route::get('quotationInvoice','QuotationController@getQuoteInvoice');
Here is my laravel controller
public function getQuoteInvoice()
{
$id = $this->getQuoteID();
$data1 = quotationGridModel::find($id)->customer()->get();
$data2 = quotationGridModel::where('QUOTE_ID',$id)->get();
$pdf = PDF::loadView('printinvoice',['data1'=>$data1,'data2'=>$data2]);
return $pdf->stream('invoice.pdf');
}
when I write quotationInvoice
in browser it gives me the print data, but how can I use this route in angularjs to get the job done. I have applied many methods like angularjs ui.router, window.assign(url);
etc but really don't understand. And in my full project I have used angularjs ui.router. Can anyone help me to do this work. Thanks in advanced.
angularjs angular-ui-router laravel-5.7
add a comment |
I don't understand how to call the correct route of laravel 5.7 from angularjs to print that route data. I have showed data on a view from laravel and when I go to that route from laravel route then I can print the data but when I try to open that route from angularjs using ui-router or simply calling my laravel route inside angularjs then I am not redirecting to that print page. My actual question is that how to go to laravel route from angularjs to print that data. And I am using dompdf. Here is my code
Here is my route
Route::get('quotationInvoice','QuotationController@getQuoteInvoice');
Here is my laravel controller
public function getQuoteInvoice()
{
$id = $this->getQuoteID();
$data1 = quotationGridModel::find($id)->customer()->get();
$data2 = quotationGridModel::where('QUOTE_ID',$id)->get();
$pdf = PDF::loadView('printinvoice',['data1'=>$data1,'data2'=>$data2]);
return $pdf->stream('invoice.pdf');
}
when I write quotationInvoice
in browser it gives me the print data, but how can I use this route in angularjs to get the job done. I have applied many methods like angularjs ui.router, window.assign(url);
etc but really don't understand. And in my full project I have used angularjs ui.router. Can anyone help me to do this work. Thanks in advanced.
angularjs angular-ui-router laravel-5.7
I don't understand how to call the correct route of laravel 5.7 from angularjs to print that route data. I have showed data on a view from laravel and when I go to that route from laravel route then I can print the data but when I try to open that route from angularjs using ui-router or simply calling my laravel route inside angularjs then I am not redirecting to that print page. My actual question is that how to go to laravel route from angularjs to print that data. And I am using dompdf. Here is my code
Here is my route
Route::get('quotationInvoice','QuotationController@getQuoteInvoice');
Here is my laravel controller
public function getQuoteInvoice()
{
$id = $this->getQuoteID();
$data1 = quotationGridModel::find($id)->customer()->get();
$data2 = quotationGridModel::where('QUOTE_ID',$id)->get();
$pdf = PDF::loadView('printinvoice',['data1'=>$data1,'data2'=>$data2]);
return $pdf->stream('invoice.pdf');
}
when I write quotationInvoice
in browser it gives me the print data, but how can I use this route in angularjs to get the job done. I have applied many methods like angularjs ui.router, window.assign(url);
etc but really don't understand. And in my full project I have used angularjs ui.router. Can anyone help me to do this work. Thanks in advanced.
angularjs angular-ui-router laravel-5.7
angularjs angular-ui-router laravel-5.7
asked Nov 27 '18 at 10:53
Akhtar MunirAkhtar Munir
6612
6612
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I have found the answer I hope it will help others too,
This is angularjs code
$http.get("quotationInvoice")
.then(function(response)){
var res = response;
console.log(res.config.url);
location.assign(res.config.url);
});
I have accessed the url from console response, and now it works Great!
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53498047%2finjecting-laravel-5-7-dompdf-with-angularjs-how-to-call-the-print-route-from-la%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I have found the answer I hope it will help others too,
This is angularjs code
$http.get("quotationInvoice")
.then(function(response)){
var res = response;
console.log(res.config.url);
location.assign(res.config.url);
});
I have accessed the url from console response, and now it works Great!
add a comment |
I have found the answer I hope it will help others too,
This is angularjs code
$http.get("quotationInvoice")
.then(function(response)){
var res = response;
console.log(res.config.url);
location.assign(res.config.url);
});
I have accessed the url from console response, and now it works Great!
add a comment |
I have found the answer I hope it will help others too,
This is angularjs code
$http.get("quotationInvoice")
.then(function(response)){
var res = response;
console.log(res.config.url);
location.assign(res.config.url);
});
I have accessed the url from console response, and now it works Great!
I have found the answer I hope it will help others too,
This is angularjs code
$http.get("quotationInvoice")
.then(function(response)){
var res = response;
console.log(res.config.url);
location.assign(res.config.url);
});
I have accessed the url from console response, and now it works Great!
answered Nov 27 '18 at 13:32
Akhtar MunirAkhtar Munir
6612
6612
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53498047%2finjecting-laravel-5-7-dompdf-with-angularjs-how-to-call-the-print-route-from-la%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown