Answer the question
In order to leave comments, you need to log in
How to open an Angular-cli project in a browser?
Hello, I can not understand why the html page in the Angular project does not open. I created a project through Angular cli. After creation launched - everything works. I started the project with the ng serve command. And this is what he gave out:
then I created an html page in the project , this
is where it is located,
then I compiled the project using the same ng serve command
and this is what he gave me
What am I doing wrong? The program in which I write the project is Visual Studio 2019 Enterprise
Thanks for the answer.
Answer the question
In order to leave comments, you need to log in
This is because you are not following the architecture of Angular applications, each individual HTML page must have a model associated with it - a TS file, optionally more CSS files and all this together is called a "component". Further, this component must be declared in the @NgModule module, the declarations field, you kind of register it in your application, indicate the TS class of the component there (1 component - 1 module), usually this is AppModule, but that's not all, in the application template ( app.component.html) or any other, insert your component's selector.
Create a component: ng gc something-cmp
Create a module: ng gm something-module The
CLI will automatically create a folder with all the necessary files and import it into the application's appmodule.
Strange structure of the SPA project ))
It gave out exactly what is in index.html => app.component.HTML
And the elements admin, header, company ...... need to be done through the creation of separate components: you can use the CLI
ng gc admin
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question