Reputation: 534
I'm new to angular, and used ng new test-proj to make an Angular project. I added some components. When I run ng serve it still takes me to the default Angular page - the one where it offers you resources and next steps and to rate their repo
I know this will seem like a stupid question but how do I run Angular so that it displays my actual app with the components I added?
Upvotes: 0
Views: 2965
Reputation: 739
every component that you make inside the angular by Angular CLI has one selector property that you should use that selector to replace the component in the desired place. for example, I have a component that just writes one hello world. inside the component there is a section that is called @component :
@Component({
selector: 'new-component',
templateUrl: '....',
styleUrls: [ '...' ]
});
you should just use
<new-component></new-component>
in the app.html.
I hope it works for you
Upvotes: 1
Reputation: 344
In your project, there's by default an app.component.html in your app-folder with the app.component.ts file corresponding to it. In this app.component.html there's this standard webpage you're seeing. You can delete all of it and use the selectors of your own application.
I can recommend doing the 'Tour of Heroes'-Tutorial offered on angular.io to get an overview of how angular works: Angular.io/tour-of-heroes
Upvotes: 2