<html>
<head>
...
</head>
<body>
<login>Initializing...</login>
</body>
</html>@Component({
selector: 'login',
template: template,
styles: [style.toString()],
directives: []
})
export class Login {
constructor() {
}
}browser_adapter.js:77EXCEPTION: Error: Uncaught (in promise): EXCEPTION: Error in :0:0
ORIGINAL EXCEPTION: The selector "login" did not match any elements
ORIGINAL STACKTRACE:
Error: The selector "login" did not match any elements
at new BaseException (https://apis.localhost/apps/login/app/vendor.js:37578:24)
at DomRenderer.selectRootElement (https://apis.localhost/apps/login/app/vendor.js:37915:24)
at DebugDomRenderer.selectRootElement (https://apis.localhost/apps/login/app/vendor.js:13318:40)
at DebugAppView.AppView.selectOrCreateHostElement (https://apis.localhost/apps/login/app/vendor.js:12866:42)
at DebugAppView._View_Login_Host0.createInternal (Login_Host.template.js:12:21)
at DebugAppView.AppView.create (https://apis.localhost/apps/login/app/vendor.js:12844:22)
at DebugAppView.create (https://apis.localhost/apps/login/app/vendor.js:13037:45)
at ComponentFactory.create (https://apis.localhost/apps/login/app/vendor.js:9594:37)
at https://apis.localhost/apps/login/app/vendor.js:7365:45
at https://apis.localhost/apps/login/app/vendor.js:7343:27There are no syntax or network errors in the console, so it is neither a syntax issue nor a typo in a file name. Even if that were the issue, the error indicates it can't find the 'login' element in index.html. The question is: how is bootstrap not finding the element when it clearly and definitely exists.
Additionally, document.getElementsByTagName('login') correctly returns the login element.
To be perfectly clear: the error does not indicate a missing component but instead indicates that the main component (the one passed to bootstrap) has a selector that does not match any elements.
Unfortunately, that is not a whole lot to go on. Check your systemjs.config to make sure the paths are assigned correctly. Make sure there is nothing in the login module that is preventing it from transpiling, make sure syntax is all 100% and objects that you reference exist.
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
It is the entire example except the CSS and HTML of the component have been excluded for brevity. They are inconsequential as the code isn't even getting as far as processing it - we are still bootstrapping which means we haven't even instantiated any components yet and the manipulation of the HTML and CSS hasn't occurred yet. Regardless, the HTML snippet is just a DIV tag and the CSS is empty.
Bootstrap is being called with a single argument: the login component class. It inspects the annotations on the class and sees the selector "login". It then searches the DOM for an element matching that selector and can't find it, therefore, bootstrapping fails. The error occurs before the component is instantiated.
If it were a problem with the transpiled code, then it would be a different error - I know because I have seen that issue before. I have never seen bootstrap unable to find the element described by the selector on the main component. The only way I see this as happening is if bootstrap isn't waiting for the document onload event, which seems silly.
So, if anyone else has seen this issue before, I'd appreciate their input. I have a second app which was used as the scaffold for this app and it works just fine.
--
The example really is this simple and it us not a problem with imports.
In order for bootstrap to get to the point where it is looking for the element in the DOM and throwing this error, all imports would have to be completed and all Javascript interpreted successfully. Otherwise, there would be no annotated class for it to inspect and no way for it to know to look for this element.
I'm going to move the call to bootstrap into the onload event of the document to see if that helps.
--