Questions tagged [angular6]

Questions about Angular version 6, the web framework from Google. Use this tag for Angular questions which are specific to only version 6. Use tag Angular for any Angular questions which are not specific to an individual version.

Questions about Angular version 6, the web framework from Google.

You can read more about Angular version 6 here

You can find Angular version 6 official documents here

7869 questions
31
votes
1 answer

Angular 6, should I put secret environment variables in environment.ts file?

There are two sub-questions: Should I put secret environment variables in the environment.ts file? The process variable shim is gone. If I use it, tsc will throw an error: Cannot find name 'process'. Here is my thing: About Q1: I don't think put…
Lin Du
  • 88,126
  • 95
  • 281
  • 483
31
votes
4 answers

Angular 6 library shared stylesheets

How can you setup a index.scss and import global stylesheets for variables, mixins, etc, to an angular 6 library? Angular CLI generates a lib with a root component & component scss, but the styles added or imported to the root component are not…
xaunlopez
  • 439
  • 1
  • 4
  • 13
31
votes
7 answers

Angular 6 - process is not defined when trying to serve application

I am getting the following error when I try to serve my angular 6 application using cosmicjs: Uncaught ReferenceError: process is not defined at Object../node_modules/cosmicjs/dist/index.js (index.js:6) at __webpack_require__ (bootstrap:81) …
Danoram
  • 8,132
  • 12
  • 51
  • 71
30
votes
7 answers

Convert HTML to PDF in Angular 6

I have a component (Angular 6) which is an aggregation of several components. This produces a long HTML (I am using Bootstrap 4). Now I want to convert this HTML to PDF. I have searched far and wide and found many solutions that work on jsPDF. The…
Vivekanand P V
  • 861
  • 3
  • 13
  • 27
30
votes
1 answer

Angular6 What's browserTarget

Here is a standard angular.json file "projects": { "myApp": { [...] "architect": { "build": { [...] "configurations": { "production": { [...] }, "debug": { [...] } } }, …
Scipion
  • 11,449
  • 19
  • 74
  • 139
30
votes
4 answers

How do I turn off source maps for Angular 6 ng test?

I am trying to turn off sourcemaps for my tests in Angular 6. I know the sourcemaps switch has been removed, e.g., ng test --sourcemaps=false. I have tried modifying my tsconfig file: { "extends": "../tsconfig.json", "compilerOptions": { ... …
ja6a
  • 416
  • 1
  • 6
  • 10
30
votes
7 answers

angular6 feature module lazy loading throwing error TypeError: undefined is not a function

I have this code in app-routing.module.ts, as per the new documentation in angular I went through the method still it's not working, throwing some errors I can't understand. import { NgModule } from '@angular/core'; import { CommonModule } from…
Abinash Mohapatra
  • 329
  • 1
  • 3
  • 6
30
votes
3 answers

Http post and get request in angular 6

In angular 5.2.x for http get and post I had this code: post(url: string, model: any): Observable { return this.http.post(url, model) .map(response => response) .do(data => console.log(url + ': ' + JSON.stringify(data))) .catch(err…
unos baghaii
  • 2,539
  • 4
  • 25
  • 42
29
votes
9 answers

Angular 6 Sort Array of object by Date

I try to sort the array object by date for my Angular 6 application. The data has string format. I wonder if there is an existing module to perform sort in Angular or we have to build sort function it in Typescript. Angular Template
Huy Le
  • 491
  • 2
  • 6
  • 11
29
votes
4 answers

Why mat-error not get displayed inside mat-form field in angular material 6 withcustom global validators

i am using angular material 6 ,i have a vaidation inside mat-form-field mat-error is not displayed , when move after mat-form-field to the mat-error which is displaying properly. Not Working code:
Mohamed Sahir
  • 2,482
  • 8
  • 40
  • 71
29
votes
4 answers

Angular 6 - Is it possible to use two angular element components on the same page?

I'm trying to host independent angular elements that I can drop into a non-angular webpage. It's working great when I have just one.. but when I load two or more on the same page I get this error: Uncaught Error: Zone already loaded. I'm using a…
hamobi
  • 7,940
  • 4
  • 35
  • 64
28
votes
5 answers

Create Component without folder

I need to create a component without the folder. I am using Angular-Cli command ng g c testing to create the component. But, the command creates an folder wrapper for the newly created component.
saravanam cs
  • 411
  • 1
  • 6
  • 11
28
votes
3 answers

Http Error Handling in Angular 6

I, am trying to handle the http error using the below class in angular 6. I got a 401 unAuthorized status from server. But however I, don't see the console error message. HttpErrorsHandler.ts file import { ErrorHandler, Injectable} from…
San Jaisy
  • 15,327
  • 34
  • 171
  • 290
28
votes
4 answers

Angular Material v6 Mat-Footer - "Cannot read property 'template' of undefined"

I'm trying to implement a footer row into a mat-table component after recently upgrading to angular 6 for this purpose, but after adding both the mat-footer-cell and mat-footer-row elements in the table, I get the following error: ERROR TypeError:…
nick.cook
  • 2,071
  • 4
  • 18
  • 36
28
votes
2 answers

Replace \n with
tag angular 6

I have a REST API with \n as backslash tags, can angular 6 replace these with
tags? Here's my code: {{x.deskripsi}} I try to use this package, but I have no idea how to use it with binding inside a {{}} tag. I tried using
Shaugi
  • 419
  • 2
  • 8
  • 18