I have an application that displays a news feed on one page (home page) and in another, it displays the feed for the user alone (user profile page).
Both pages look and behave in the same way. The change in content is due to different URLs called.
How to solve this in angularjs?
I have a home controller that has all the methods/logic used to display the home page.
Now I need to have one more controller that calls the other URL and does the same thing as a home controller.
I was thinking of something like the parent controller and two controllers. But it looks like in angularjs controller inheritance is determined by the dom structure. In my case, they are two different pages. So I cant create a dom style inheritance.
I am confused on how to solve this without duplicating the code in both controllers.
I will be happy to add more details to this question if needed. I went through a number of google results but I couldn't figure out how to do this.