Error installing Angular using npm due to require-from-string

as stated in the issue link: temporal solution: npm install https://github.com/floatdrop/require-from-string/tarball/v1.1.0 –save npm install UPDATE: It appears they are working on it. The require-from-string page used to return a 404, but at least now it loads the correct page on NPM’s website: https://www.npmjs.com/package/require-from-string Still doesn’t appear to be working through npm install yet. UPDATE 2: … Read more

How to debug angular app using angular-cli webpack?

How to debug with angular/cli The new angular/cli version uses webpack which does not compile the ts files to an local directory like dist before (till beta 1.0.0-beta.10). Now it uses some memory like approach. But you can find the ts Files in the Chrome Developer Tools in the “Sources” tab. (new) Solution for angular/cli@1.0.0-beta.26 … Read more

Dynamically load HTML template in angular2

You could use [innerHtml] in a my-template component with something like this (I didn’t test) : @Component({ selector: ‘my-template’, template: ` <div [innerHtml]=”myTemplate”> </div> `}) export public class MyTemplate { private myTemplate: any = “”; @Input() url: string; constructor(http: Http) { http.get(“/path-to-your-jsp”).map((html:any) => this.myTemplate = html); } }

Error: Local workspace file (‘angular.json’) could not be found

I just had the same problem. It’s related to release v6.0.0-rc.2, https://github.com/angular/angular-cli/releases: New configuration format. The new file can be found at angular.json (but .angular.json is also accepted). Running ng update on a CLI 1.7 project will move you to the new configuration. I needed to execute: ng update @angular/cli –migrate-only –from=1.7.4 This removed .angular-cli.json … Read more

How to set environment via `ng serve` in Angular 6

You need to use the new configuration option (this works for ng build and ng serve as well) ng serve –configuration=local or ng serve -c local If you look at your angular.json file, you’ll see that you have finer control over settings for each configuration (aot, optimizer, environment files,…) “configurations”: { “production”: { “optimization”: true, … Read more

Get angular-cli to ng serve over HTTPS

Angular CLI 6+ I’ve updated my own projects so I figured I can now update this answer too. You’ll now put the path to your key and certificate in your angular.json file as follows: { “$schema”: “./node_modules/@angular/cli/lib/config/schema.json”, “projects”: { “<PROJECT-NAME>”: { “architect”: { “serve: { “options”: { “sslKey”: “<relative path from angular.json>/server.key”, “sslCert”: “<relative path … Read more