Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rendering Just one module/state of Angular app

I've angular app with lots of states and modules etc. Now, I want to send a link to the user. When user'll hit this url, I want to redirect him to a new tab rendering only that particular state (specified in URL) i-e I don't want anything else to be visible to the user. Or you can say, I want to open a popup window rendering that particular state's html in popup window . This is the approach that comes to my mind to sort it out.

Ps. There are Rest APIs at the backend which I am calling through angular resource service to bind data with the model of the views

Option

I've rest APIs on backend, So, I was thinking to developing s separate Nodejs application, And I will send nodejs application url to the user and in the default/home route I'll call backend API and, the returned resultset will be rendered in html file within nodeJs application and this way, I'll render the corresponding data to user's browser window.

This is the flow for thatenter image description here

I don't know if that is right or clever approach. Please suggest me what will be the best approach to sort it out.

Thanks in advance.

This is what my app looks like

enter image description here

Everything in the left side-nav is a module and clicking on this I am routing to a different state. I am using angular-material and lots of other dependencies in this project.

And this is what I want.

I'll refer a link to the user for example www.myapp.com/specificpage.html. And hitting this url, a new tab/popup will be opened rendering state defined in the same app but with some non-editable url. And it should like.

enter image description here

like image 623
Muhammad Usman Avatar asked Nov 01 '17 14:11

Muhammad Usman


1 Answers

There are multiple ways to achieve this and each approach has advantage and disadvantage. You have to choose depending on requirement and architecture. Details are below-

  1. Create a separate app - You can do it through separate code base or use the module based build process and include this module only for new app.
  2. Divide application is two part, public pages and private pages - Include this page and required APIs for this page in the public modules for your app.
  3. Send token in the link - If you want to make secure page, send short lived token in the eMail and validate token on the server before displaying page to the user.
like image 166
ManishSingh Avatar answered Oct 21 '22 22:10

ManishSingh