Angular-cli from css to scss

For Angular 6 check the Official documentation Note: For @angular/cli versions older than 6.0.0-beta.6 use ng set in place of ng config. For existing projects In an existing angular-cli project that was set up with the default css styles you will need to do a few things: Change the default style extension to scss Manually … Read more

How to load image (and other assets) in Angular an project?

In my project I am using the following syntax in my app.component.html: <img src=”/assets/img/1.jpg” alt=”image”> or <img src=”http://mruanova.com/img/1.jpg” alt=”image”> use [src] as a template expression when you are binding a property using interpolation: <img [src]=”imagePath” /> is the same as: <img src={{imagePath}} /> Source: how to bind img src in angular 2 in ngFor?

How to get the Angular version?

ng version You installed angular cli globally (-g in the command). This means that you can type ng version into your command prompt. It may be more precise to do this when your command prompt is not within a npm controlled directory (you should type this in within directory you typed ng new myapp). A … Read more

Set default host and port for ng serve in config file

Angular CLI 6+ In the latest version of Angular, this is set in the angular.json config file. Example: { “$schema”: “./node_modules/@angular/cli/lib/config/schema.json”, “projects”: { “my-project”: { “architect”: { “serve”: { “options”: { “port”: 4444 } } } } } } You can also use ng config to view/edit values: ng config projects[“my-project”].architect[“serve”].options {port:4444} Angular CLI <6 … Read more

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 execute only one test spec with angular-cli

Each of your .spec.ts file have all its tests grouped in describe block like this: describe(‘SomeComponent’, () => {…} You can easily run just this single block, by prefixing the describe function name with f: fdescribe(‘SomeComponent’, () => {…} If you have such function, no other describe blocks will run. Btw. you can do similar … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)