Reputation: 136
I'm fairly new to AngularJS but I'm implementing a web app to display some information and would like to have a admin panel for my personal use.
The layout will be very different so I was thinking of having two index pages with each layout, for example index.html and admin.html, and have independent partials on each one, is this possible on AngularJS or should I just have a partial with the admin panel?
Upvotes: 0
Views: 1604
Reputation: 3124
You could take this approach - you would end up with two separate angular applications attached to those different pages.
If you went this route, you could reuse code via services so when you are developing your 'public' application keep this in mind. Keep the controllers as clean as possible and when you are fetching and dealing with data (especially the same data you will use in your admin app), put that functionality into a service. You can then include it and inject it the same way in your admin application.
The other route would be to take the approach of role based security but that would involve setting up server side authentication and authorization and protecting your admin partial with a server side role along with keeping track of the roles in Angular. This is a more advanced approach but could be more maintainable over time.
Upvotes: 1