Keep in mind that I work with the tutorial code here, so not everything is strictly correct, but it works. Most part of time.
I have a component class that is styled as follows:
@Component({ selector: "click-here", template: ` <button (click) = "onClickThere($event)">Click here!</button> {{clickMessage}} ` })
And it was used as follows:
<body> <click-here>Loading...</click-here> </body>
Then I added a new component class, but its decorator has:
selector: "type-here"
When I launch the application with npm start , I get a legion of errors in the browser, starting with:
The selector "click-here" did not match any elements
Why should each selector match an element? It is impossible to work this way; there should be a way to have multiple Component decorators, all with different selector values, and use only some of them. How do I achieve this? What am I doing wrong that the correct version is not included in the textbook? Should each Component have a name or something else?
source share