how to deploy angular2 app built using angular-cli -


i have created n new angular app using angular-cli.

i completed app , preview using ng-serve, working perfectly.

after used ng build --prod, generates 'dist' folder. when put folder in xampp run, not working. found there no *.js files, should in there after *.ts -> *.js conversion (i suppose).

i have attached screenshot, in on left side showing src folder having .ts files, on middle showing 'dist' folder , browser screenshot.

please guide me how can generate working app angular-cli, can run in xampp server.

screenshot:

screenshot

method 1(popular one) : if using angular-cli,

ng build --prod 

will trick. can copy .dist folder server folder

method 2 :

you can use http-server serve app . install http-server

npm install http-server -g 

and after going project folder

http-server ./dist  

it serve files in folder. can check terminal ip-address , port can use access application. open browser , type

ip-adress:port/index.html 

hope :)

bonus : if want deploy in heroku. please go through detailed tutorial https://medium.com/@ryanchenkie_40935/angular-cli-deployment-host-your-angular-2-app-on-heroku-3f266f13f352


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -