Category "angular"

Should I initialise an Angular service in its constructor or in the ngOnInit method of the app.component?

I'm new to Angular. I have a service that needs to subscribe to a subject provided by another service. If this was a component, I would create the subscription

How to pass class style from parent to child in Angular, and using it in specific element

so I'm using a template that I downloaded of ngx-admin. I'm creating new lib of some simple components such as input with labels and etc. this lib component is

Angular Material MatFormField appearance="fill" theming questions

I have a question dealing with Angular Material theming, specifically the MatFormField directive. Probably around Material v6, I found that the matFormField dir

Angular 9 display number of change detection cycles on the UI? stackblitz inside

I'm trying to build a small dev component that displays only in non-production builds. One of the things that I see useful to keep track of is the number of c

Primeng expandable column headers don't show

I have an expandable row in Angular2 using Primeng2 but the column headers for the expandable columns aren't showing. This is my table with the expandable rows

Angular 2 and browser autofill

I'm implementing login page with Angular reactive forms. Button "login" is disabled if form is invalid. import { Component, OnInit } from '@angular/core'; impo

How to add global style to angular 6/7 library

I was trying to add global styles in the same way like in angular app, but it totally does not work. My libraries' name is example-lib, so I added styles.css to

Angular: ng new error when I create an angular project

I have this error using ng new project_name: An invalid configuration file was found ['angular.json']. Please delete the file before running the command. I am

Angular click debounce

In my template I have a field and two buttons: <div class="btn-plus" (click)="add(1)"> - </div> <div class="txt"> {{ myValue }} </div>

How to get nativeElement from @ViewChild in Ionic 4/Angular7?

I am using Ionic 4's ion-search like so: <ion-searchbar #searchbarElem (ionInput)="getItems($event)" (tap)="handleT

Can't run an Angular 2 Component inside an Angular 1 component in Visual Code

My Index.html is <!doctype html> <html> <head></head> <body> <script src="node_modules/core-js/client/shim.min.js">&

Error importing ngx-charts to Angular as separate component: error NG8001: 'ngx-charts-tree-map' is not a known element

I have imported ngx-charts in the way suggested in this link: https://stackblitz.com/edit/swimlane-tree-map-chart?embed=1&file=app/app.component.ts Howeve

How can i check all mat-checkbox in angular5?

I want when I click check-all; check-1, check-2 and check-3 are also checked. How can I do that? <form> <mat-checkbox type="checkbox" class="selec

How can I upload the data to my p-multiSelect?

I'm working with the primeNG component, but I can't load the data. MultiSelect this.listadoProductos = this.resolucionDatosCargados['listProduct']; this.par

How do I import svg from file to a component in angular 5?

All tutorials with adding svg to a component in AngularCli that I found recommend to insert it in html template, something like this: <div> <svg vi

NWjs - Building Angular 2 Desktop Apps

I am trying to build an Angular 2 Desktop App with NWjs. What is the entry point? Any examples of Building Angular 2 Desktop Apps with NW.js

Do I have to unsubscribe from ActivatedRoute (e.g. params) observables?

I find many examples where ActivatedRoute Observables like params or url are subscribed but not unsubscribed. constructor(private route: ActivatedRoute) {} ng

Angular 2: How to redirect route to child route with named outlet

I´m having a problem with Angular 2 router. I cannot get it to redirect to a specific child route with a named outlet. I think it´s a problem of URL

How to reload the current route with the angular 2 router

I am using angular 2 with hashlocation strategy. The component is loaded with that route: "departments/:id/employees" So far fine. After I do a successful batc

How to define Typescript Map of key value pair. where key is a number and value is an array of objects

In my angular2 app i want to create a map which takes a number as key and returns an array of objects. I am currently implementing in following way but no luck.