Home > OS >  Getting confused adding new pages to a Web App
Getting confused adding new pages to a Web App

Time:04-01

Basically the job has the API and Databases all set up in Visual Studio as a MVC project and I update and create new content in a separate Angular CLI project in VS Code and link to it (I think, I'm more a Front End Developer)

But where I am struggling to understand is where do I create new pages for the Site and how? Right now I've made a Folder with a newPage.component.html, newPage.component.scss and newPage.component.ts but they're not linked to anything yet

Is this the right way to do this? Or should I be making them in the API sections instead?

CodePudding user response:

You are pretty much correct. The API should exist to give you the data you need on the front end. So when you create a new component in Angular, you can fetch the data and display it. You "link" your angular components (you called a folder) by using either your routing module ei: { path: 'home', component: HomeComponent} or you can use a component directly in the html by adding its selector to wherever you want it displayed.

CodePudding user response:

If you are building an SPA your setup should be Asp.net core web api Angular frontend. You dont need MVC, as the backend won't serve any views. Your api will serve only data, as rleffler pointed out. As for creating new pages, just use angular-cli to create new components. In fact, you use cli to generate almost everything in the frontend. If you are new to Angular, just read the heroes tutorial on the angular website and then some routing tutorial. I think routing is one of the first things one should learn when starting with Angular.

  • Related