How to hosting angular 2 with Angular CLI and Github pages?

How to hosting angular 2 with Angular CLI and Github pages?

If you have already Node.js install,Installing the CLI is easy.
 sudo -s
 npm install -g angular-cli
Create new app with 'ng new' command.
 ng new coderkishan
 cd coderkishan
And then launch the app in your browser for testing with 'ng serve'
 ng serve

You can see message on command ** NG Live Development Server is running on http://localhost:4200. **
Launch your application in your browser : http://localhost:4200.
Deploy your app to GitHub Pages.
create a new repository on GitHub,unchacked initialize this reposititory with a README.
Register new repo using below command.
 git remote add origin https://github.com/USERNAME/PROJECT_NAME.git
Push your code using below command.
 git push origin master
Your angular-2 application code will be up on github,but your hosted app will not be up on GitHub Pages yet. run the below command and deploy the github pages,this command also create one branch called 'gh-pages'.
 ng github-pages:deploy

Within a few minut your app should be up and running at http://USERNAME.github.io/PROJECT_NAME.

No comments:

Powered by Blogger.