-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Closed
Description
Bug Report or Feature Request (mark with an x
)
- [ x ] bug report -> please search issues before submitting
- [ ] feature request
Versions.
Angular CLI: 1.5.0
Node: 6.11.5
OS: darwin x64
Angular: 5.0.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
@angular/cli: 1.5.0
@angular-devkit/build-optimizer: 0.0.32
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.35
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.1
typescript: 2.4.2
webpack: 3.8.1
Repro steps.
ng generate component foo
The log given by the failure.
ERROR in src/app/foo/foo.component.ts(7,18): error TS2304: Cannot find name 'ViewEncapsulation'.
Desired functionality.
The generated component refers to ViewEncapsulation
without importing it. Either it should be imported, or it should not appear at all. Right now it is:
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-foo',
templateUrl: './foo.component.html',
styleUrls: ['./foo.component.css'],
encapsulation: ViewEncapsulation.None
})
export class FooComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
So the line:
encapsulation: ViewEncapsulation.None
should probably go, or the import at the start should be:
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
BTW, why should it be ViewEncapsulation.None
?
Mention any other details that might be useful.
Metadata
Metadata
Assignees
Labels
No labels