Is it possible to dynamically change global stylesheets in Angular 2?

Is it possible to dynamically change global stylesheets? EDIT: The purpose is to allow the user to pick the styles he prefers. In Angular 1, I was able to wrap a controller around the head tag and use bindings in there. Example below (simplified code): index.html <!DOCTYPE html> <html ng-app=”app” ng-controller=”AppController”> <head> <title>Title</title> <link rel=”stylesheet” … Read more

Angular 2 RC 5 Attempting to Get and Display a PDF from a Server

I am trying to display a PDF that is generated from a server onto a view in my Angular 2 RC 5 project. Right now, the ASPNETCORE server is returning the object as an ‘application/pdf’ and the Angular client is trying to parse the response as a blob. However, I get the following error on … Read more

angular 4 how to access ViewChildren _results

i have a list of checkboxes inside an ngFor: <md-checkbox #hangcheck [id]=”hangout?.$key” class=”mychecks” > I’m Interested </md-checkbox> i refrence them in the component like so: @ViewChildren(“hangcheck”) hangchecks: QueryList<any>; then in ngAfterViewInit i need to loop them: ngAfterViewInit(){ console.log(‘the array: ‘,this.hangchecks) this.hangchecks._results.forEach((item) => { console.log(‘the item: ‘,item) }); } but i get: Property ‘_results’ is private … Read more

Force routerlink to refresh component

I have created a very basic angular 5 application. I have a left menu which is always displayed (it is part of asp.net core2.0 mvc project skelton with bootstrap). I have created 2 links in this menu: <li> <a [routerLink]='[“/component/1”]’>Component 1</a> </li> <li> <a [routerLink]='[“/component/2”]’>Component 1</a> </li> As you can see, the 2 links points … Read more

Rendering the components in ContentChildren of Angular

This is my component: import { Component, OnInit, ContentChildren, QueryList } from ‘@angular/core’; import { IconBoxComponent } from ‘../icon-box/icon-box.component’; @Component({ selector: ‘app-three-icon-box’, templateUrl: ‘./three-icon-box.component.html’, styleUrls: [‘./three-icon-box.component.scss’] }) export class ThreeIconBoxComponent implements OnInit { @ContentChildren(IconBoxComponent) boxes: QueryList<IconBoxComponent>; constructor() { } ngOnInit() { } ngAfterContentInit() { console.log(this.boxes); } } Its template looks like this: <div class=”row justify-content-center”> … Read more

Display a simple alert dialog in Material Angular

I’m using Material Angular (from Angular Material). The examples in the site seem a Little too overcomplicated and every other tutorial in the internet seems either outdated or to be using AngularJS instead. How can I show a simple alert (just like Android’s AlertDialog) with a title, a message and a confirm/cancel button? Answer EDIT: … Read more

BrowserslistError: Unknown version 67 of android

I have created one angular library using angular 8 and CLI 8. I am trying to build the library, but I am getting the error. ng build <lib-name> I have gone through some questions posted related to this error, most of them say remove node_modules and reinstall them. I tried this solution but still, I … Read more

Is it possible to use ES5 JavaScript with Angular 2 instead of TypeScript?

Is it needed to learn TypeScript for Angular 2? Can Angular 2 be used with plain JavaScript ? Edit: I’ve seen that the languages used as ES6, ES7, Dart compile to JavaScript to be executed, but I haven’t seen any reference to use ES5 JavaScript directly. Answer Yes, you can. Go read this guide. Pressing … Read more