instead of typing :

ng serve --host example.com --port 4205

We just want to type



ng serve

Angular CLI 6+


Angular CLI 6+

In the latest version of Angular, we can set this in the angular.json config file

{
    "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
    "projects": {
        "my-project": {
            "architect": {
                "serve": {
                    "options": {
                        "port": 4205,
                        "host": "example.com"
                    }
                }
            }
        }
    }
}

We  can also use ng config to view/edit values:

ng config projects["my-project"].architect["serve"].options {port:4444}

By Shabazz

Software Engineer, MCSD, Web developer & Angular specialist

Leave a Reply

Your email address will not be published. Required fields are marked *