I have an angular application. I have it set by scafolding using Yeoman and its generator-angular app. I am testing it using grunt serve.
I have few basic questions -
Is this a node application?
Since this application is going to be run in two environments (like pre-production and production), is there a way in my angular app I get the details of which environment it is run?
Let me try to explain
No this is a framework developed by Google team
There are many ways and tools to do that like gulp , grunt, webpack and yes there are many ways to set the environment and to get the environment
Try to look at any angular-seed and tutorial with tools like gulp, grunt and webpack.
Related
I'm looking into creating an app with typescript and angular 1.6.0. But everywhere I look is using webpack, babel, grunt, gulp, there is no single consensus on which is the best way to proceed with an app like this.
Anyone got any hints?
Thank you.
Do you have a specific need for using angular 1.6.0? As opposed to creating an angular2 project?
You can get more information here: Angular-cli
Angular cli currently includes webpack and you will not need to use gulp or grunt at all. In addition to the angular cli bundling your app together it allows easy build for Ahead of Time Compilation and tree shaking. Having these two features is nice for when you are ready to deploy your application to a production server you can bundle the application into a small package and serve a small amount of JS files.
Using the angular cli also helps you to code with best practices within an angular2 application. You generate new components/directives/pipes with a simple ng generate [component] [name] command.
I would strongly suggest reading through the angular quickstart for ts guide located here: Angular-Quickstart
Also, if you do not want to generate your own projects using the angular-cli. There are various templates online that you can start your application with.
Good luck!
If you are planning to start from scratch, then why not Angular2 ?
My suggestion is Typescript2 + Angular2 with webpack. As stated by #Andy Angular-cli is good to go.
I have an app that is running using grunt for development.
Shifting this to a production environment, though, it's apparently not recommended to use Grunt.
With the yeoman team's angular generator, what do I need to do to get my app ready for production?
grunt serve:dist doesn't work (because the file names and paths are obviously different than development).
I have built a basic angular 2 app. However I need to deploy it on Jboss or Tomcat as I need to use it along with my Java EE application.
Thanks for your help.
You would use a bundler such as angular-cli or webpack to create the production bundle which is then served by the HTTP server. The bundler creates all required file that go into the htdocs directory. Normally Angular apps are completely decoupled from your backend server so there shouldn't be any JBoss or Tomcat specifics.
The Angular team are going to increasingly focus on angular-cli as the premier bundling solution so it might be a good idea to start there.
If you are using angular-cli you can use ng build command. It creates all static files for deploy Angular2 app into the dist folder. You must copy and paste them in webresources folder of your Web Application (WAR). At the moment I am looking for how to deploy this files easier.
I have a basic Angular app installed using a Yeoman fullstack installer, and I can see the basic pages running on http://localhost:9000 when I run 'grunt serve'.
I also have a Vagrant installation running using the ubuntu/trusty64 box. I was originally seeing a 404 when trying to view http://127.0.0.1:4567/, but following some instructions I found online, I edited the file in 'vagrant ssh' at /etc/apache2/sites-enabled/000-default.conf by removing the html part of the path in that file. After doing 'vagrant reload' I now see the list of files in my project dir when I go to that URL.
How do I go about viewing my angular app like it is at localhost:9000? If I get this working will this mean that if I share via Vagrant, they'll see the angular app running as it should? Do I still need to be running grunt serve in combination with Vagrant?
I'm pretty new to all this setup, so I'm just following the instructions at https://github.com/DaftMonk/generator-angular-fullstack & https://docs.vagrantup.com/v2/getting-started/index.html
I'm not great with Linux/cmd line stuff as yet, hence my problems... :)
Thanks!
I started writing instructions for you on how to get it done. But then realised that you are not very comfortable with linux commands. I have created a angular-seed project that uses vagrant, angular and requirejs. Its easy to set up and I have written instructions on how to do that in my github page.
Just clone it, follow the instruction and you will have a working seed project in no time. Some of the features of the seed are:
Uses vagrant and puppet to provision the vm. All required dependencies are automatically installed.
Grunt tasks for:
autoloading bower dependencies
compile sass or scss
livereload
server for access of site locally
If you have any difficulties or questions, feel free to contact me.
I have Ruby on Rails as my primary programming language and the workflow mostly went as make changes-commit changes-push changes-deploy with capistrano
I looked over the internet for ways to have such a workflow (or at least quite similar) for Angular.JS and I can't seem to find one. There is Yeoman but I can only see examples for Heroku. I host with Webfaction right now.
So I was wondering is there some way to track an angular JS project with Git (preferably Github) then deploy it to Webfaction from that git repo?
Thanks in advance!
I use yeoman to setup angular.js apps and capistrano to deploy them on production (digitalocean) - I wrote an article about this: http://howwedoapps.com/2014/04/03/deploy-angularjs-app-with-capistrano-on-the-cloud. I hope it helps.
I don't know anything about Webfaction, but if it's a VPS you have take a look at Dokku.
It's basically your own Heroku, hosted on your own server.
While it's not specificaly git based, capistrano is one of the most popular ways of deploying ruby web application to a vps. It has features that would allow you to deploy from github, but that would need to be configured separately and would need to be called from the command line from your development computer.