Angular 5: uncaught ReferenceError: ViewEncapsulation is not defined
See original GitHub issueBug 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
Issue Analytics
- State:
- Created 6 years ago
- Reactions:15
- Comments:22 (1 by maintainers)
Top Results From Across the Web
Getting "viewEncapsulation is not defined" when adding ...
D:\GIT\PartnerOrders2\node_modules\angular-cli\blueprints\component\files__path____name__.component.ts),. Anyone have an idea how to solve?
Read more >Uncaught ReferenceError: Angular is not defined
In this article, we will see the “Uncaught ReferenceError: Angular is not defined”, along with knowing a possible way to resolve it.
Read more >View encapsulation - Angular
In Angular, a component's styles can be encapsulated within the component's host element so that they don't affect the rest of the application....
Read more >process is not defined angular - You.com | The AI Search ...
Angular 11: Uncaught ReferenceError: process is not defined ... For webpack 5, you can reference process/browser from the appropriate plugins part of ...
Read more >Let • Angular - codecraft.tv
Copy Uncaught ReferenceError: a is not defined(…) This is because the a variable is declared inside a function and is therefore only visible...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is the official solution: https://angular.io/api/core/ViewEncapsulation
npm Package | @angular/core import { ViewEncapsulation } from ‘@angular/core’;
Looks like the ViewEncapsulation are now imported after upgrading to Angular 5.0.1.
I would also thank the Angular team which are working really hard on this amazing product! And please people, who complains… Stop doing it. You are not paying for this products, so if there are any bugs, instead of complaining, you should try to help to fix the bugs! 😉