简体   繁体   中英

Angular 2 What to do when you don't want to have a selector on a page

I'm very new to Angular, so sorry if this is a bit of a silly question.

Right now I have a BlogComponent, which is a CRUD system that handles my blogging engine. However this selector only appears on the /blog section of my website. The routing itself is done by my backend (ASP.NET Core).

When I browse to / I get an error in the console saying "The selector "blog" did not match any elements"

How am I supposed to fix this? Has it something to do with routing?

This doesn't have anything to with routing. The error means that Angular is looking for a component definition with a selector that matches <blog> (ie selector: 'blog' ) but it can't find one. Typically this means that you haven't registered your BlogComponent in the declarations array of your module. Check out the guide on modules for more.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM