Hiển thị các bài đăng có nhãn Angular CLI. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn Angular CLI. Hiển thị tất cả bài đăng

How to upgrade Angular CLI to the latest version

Source:

After reading some issues reported on the GitHub repository, I found the solution.
In order to update the angular-cli package installed globally in your system, you need to run:
npm uninstall -g angular-cli
npm cache clean or npm cache verify (if npm > 5)
npm install -g @angular/cli@latest
Depending on your system, you may need to prefix the above commands with sudo.
Also, most likely you want to also update your local project version, because inside your project directory it will be selected with higher priority than the global one:
rm -rf node_modules
npm uninstall --save-dev angular-cli
npm install --save-dev @angular/cli@latest
npm install
thanks grizzm0 for pointing this out on GitHub.
After updating your CLI, you probably want to update your Angular version too.
Note: if you are updating to Angular CLI 6+ from an older version, you might need to read this.
Edit: In addition, if you were still on a 1.x version of the cli, you need to convert your angular-cli.json to angular.json, which you can do with the following command:
ng update @angular/cli --from=1.7.4 --migrate-only
(check this for more details).

Create component to specific module with Angular-CLI

Source: https://stackoverflow.com/questions/40649799/create-component-to-specific-module-with-angular-cli
To create a component as part of a module you should
  1. ng g module newModule to generate a module,
  2. cd newModule to change directory into the newModule folder
  3. ng g component newComponent to create a component as a child of the module.

Get Component without spec.ts file in Angular

Source: https://stackoverflow.com/questions/40990280/get-component-without-spec-ts-file-in-angularjs-2


Inside your angular-cli.json set the spec.component parameter to false:
{
   ...
   "defaults" : {
       ...
       "spec": {
           ...
           "component": false
       }
   }
}
or use the --spec=false option during creation
ng generate component --spec=false component-name



Set up Angular CLI and simple angular application

Source: https://angular.io/guide/quickstart

Install Node.js® and npm if they are not already on your machine.
Verify that you are running at least node 6.9.x and npm 3.x.x by running node -v
and npm -v in a terminal/console window.
Older versions produce errors, but newer versions are fine.
Then install the Angular CLI globally.
npm install -g @angular/cli






 Create a new project

Open a terminal window.
Generate a new project and skeleton application by running the following commands:
ng new my-app
Patience, please. It takes time to set up a new project; most of it is spent installing npm packages.

Serve the application

Go to the project directory and launch the server.
cd my-app
ng serve --open

The ng serve command launches the server, watches your files, and rebuilds the app as you make changes to those files.
Using the --open (or just -o) option will automatically open your browser on http://localhost:4200/.
Your app greets you with a message:



The app works!

Renewing Facebook Graph API token automatically?

  Mã truy cập dài hạn https://developers.facebook.com/docs/facebook-login/guides/access-tokens/get-long-lived/ https://community.n8n.io/t/re...