问题
my index.html body:
<body>
<my-forget>Loading...</my-forget>
<router-outlet></router-outlet>
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('app/boot')
.then(null, console.error.bind(console));
</script>
</body>
</html>
and forget.component.ts:
import {Component} from 'angular2/core';
import{RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';
import {LoginComponent} from './login.component';
@RouteConfig([
{path:'/app', name:'login-page', component:'LoginComponent'},
{path:'/*other', name:'other', redirectTo:['login-page']}
])
@Component({
selector: 'my-forget',
templateUrl: '../templates/forget.component.html',
directives: [ROUTER_DIRECTIVES]
})
export class ForgetComponent {
}
Ignore routing parts. I'm getting the following errors: Error: Uncaught (in promise): The selector "my-login" did not match any elements
The selector "my-login" did not match any elements
I don't have my-login in these files and i don't need it! What is wrong?
来源:https://stackoverflow.com/questions/38565942/why-getting-the-error-the-selector-did-not-match-any-elements