どうも中田です
Angularでコンポーネント名を階層構造にあった名前にしようとコンポーネント名を変えて起動してみるとエラーになっちゃって。。という内容です
コンポーネントはこれで作りました
$ ng g component xxx/login
んで
LoginComponent => XXXLoginComponent
ってクラス名を変更してみると
エラー
ERROR in src/app/xxx/xxx-routing.module.ts(4,10): error TS2305: Module '"/src/app/xxx/login/login.component"' has no exported member 'XXXLoginComponent'. src/app/xxx/xxx.module.ts(6,10): error TS2305: Module '"/src/app/xxx/login/login.component"' has no exported member 'XXXLoginComponent'.
その時コンポーネントはというと
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css']
})
export class XXXLoginComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
どこがおかしいのかなー
どこかなー
解決
コンポーネントのselectorもちゃんと名前を合わせないとですね
@Component({
selector: 'app-xxx-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css']
})
...
...
ということでした!









