I am experiencing a weird issue related to Angular CLI which seems not creating components correctly for causes unknown. When I write "ng generate component modal" or I use the IntelliJ Angular CLI tool, the result is in a bad rendering of the component.ts files.
Have a look here, please:
import {Component, OnInit
< %
if (!!viewEncapsulation) { %>,
ViewEncapsulation < %
}
%>
< %
if (changeDetection !== 'Default') { %>,
ChangeDetectionStrategy < %
}
%>
}
from
'@angular/core';
@Component({
selector: 'app-form-modal', < % if
(inlineTemplate)
{ %>
template: `
<p>
form-modal works!
</p>
`, < %
}
else
{ %>
templateUrl: './form-modal.component.html', < %
}
if (inlineStyle) { %>
styles: [] < %
} else { %>
styleUrls: ['./form-modal.component.css'] < %
}
%>
< %
if (!!viewEncapsulation) { %>,
encapsulation: ViewEncapsulation. < %= viewEncapsulation % > < %
}
if (changeDetection !== 'Default') { %>,
changeDetection: ChangeDetectionStrategy. < %= changeDetection % > < %
}
%>
})
export class
< %= classify(name) % > Component
implements
OnInit
{
constructor()
{
}
ngOnInit()
{
}
}
Can you please explain me what weirdeness it is? Thank you in advance.
EDIT:
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 6.0.8
Node: 8.10.0
OS: linux x64
Angular: 6.0.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-optimizer 0.6.8
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.6.8
@angular/cli 6.0.8
@ngtools/webpack 6.0.8
@schematics/angular 0.6.8
@schematics/update 0.6.8
rxjs 6.2.1
typescript 2.7.2
webpack 4.8.3
As requested I added also the result of ng --v
.
Consider that this project has been imported as webapp child folder in a bigger Java application. I can run the Angular App properly with ng serve --open
.