angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Angular 5: uncaught ReferenceError: ViewEncapsulation is not defined

Open ghost opened this issue 9 years ago • 22 comments

Bug Report

- [ 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/cdk: 5.0.0-rc0
@angular/cli: 1.5.0
@angular/material: 5.0.0-rc0
@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 header

TS code:

import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-header',
  templateUrl: './header.component.html',
  styleUrls: ['./header.component.css'],
  encapsulation: ViewEncapsulation.None
})
export class HeaderComponent implements OnInit {

  constructor() { }

  ngOnInit() {
  }

}

The log given by the failure.

header.component.ts:7 Uncaught ReferenceError: ViewEncapsulation is not defined
    at eval (header.component.ts:7)
    at eval (header.component.ts:16)
    at Object.../../../../../src/app/header/header.component.ts (main.bundle.js:58)
    at __webpack_require__ (inline.bundle.js:55)
    at eval (app.module.ts:5)
    at Object.../../../../../src/app/app.module.ts (main.bundle.js:36)
    at __webpack_require__ (inline.bundle.js:55)
    at eval (main.ts:4)
    at Object.../../../../../src/main.ts (main.bundle.js:74)
    at __webpack_require__ (inline.bundle.js:55)

Desired functionality.

Fails to render in browser with console error

Mention any other details that might be useful.

Mac OS

ghost avatar Nov 07 '17 08:11 ghost

@sankarkumar23 you should check out the issue linked by @Brocco I think you'll find he pushed an update 4 days ago changing the default back to Emulated - https://github.com/angular/devkit/commit/60ce9969c30cf79460a855a47d4da99ee66b5edb

mtpultz avatar Nov 14 '17 19:11 mtpultz

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.