Hrides Thakur

Hrides Thakur

  • NA
  • 292
  • 49.7k

Suggestion on Angular application architecture

Jul 27 2018 12:51 AM
Hello
 
i am creating one angular admin application in which my first screen is login page.
first user has to login after successfull login user redirect to dashboard which has menus and other details.
 
my application architecture is:
i will descrive what code i have in the different files and filders, i want to know that it is good preactice or i should make some changes.
 
index.html: it has css file reference and in body it has only. my concern is. is it ok? i am asking bcz only i have only app-root in this file.  
 
style.css : it is the main css file for the application, which is used in all the components.
app-routing.module.ts: it defines routing for the application. default first is login screen.
app.module.ts: it has references for many ts file and defines bootstrap for AppComponent  
 
app.component.html and .ts:  html has only routrt-outlet nothing else. Ques: is it good to have a file which has only one line router-outlet (yes i know i can write this in .ts also in template).
 
login.component: it has login functionality which is ok. And afte successfult login it redirect to Home component home screen.
 
Home.component: it has header componet which is menu and again router-outlet only two lines.so i have some concern or not sure for this architecture. and home has child routes and default is Dashboard.
 
{ path: 'home', component: HomeComponent,
children: [
{ path: '', component: DashboardComponent },
 
thats it for UI.
 
I hahe model folder which contains all the ts model classes for application.
 and service foler which contains service classes for application.
 
please let me know is it ok or not or please suggest any changes if required.
i have bit doubt on the index, home 

Answers (1)