[Javascript - Angular ] - Play with Angular: Get help from YEOMAN and Debugging with WebStorm
note: AngularJS is amazing.
warning: don't think in jQuery, think in AngularJS
the developer is trying to "do jQuery" in the context of AngularJS. That's never going to work well. The view is the official record. Outside of a directive, you never, ever, never change the DOM. And directives are applied in the view, so intent is clear.
1. Let's start on the right foot: scaffolding workflow
2. Configure grunt server on WebStorm: so no need to start server from terminal app
3. Productive: Install AngularJS extension: more autocomplete to be productive
4. Debugging: Setup Debugger: so that we can be stress free (or minimum stress)
5. Process: Let generator do the job
6. Learning: Study & Get Help
1. Let's start on the right foot
Let Yeoman do the job. Yeoman will help us "scaffolding workflows for creating modern webapps, while at the same time mixing in many of the best practices that have evolved within the industry."
$ npm install -g yo
above command will installs grunt, karma etc
Karma: unit test framework specifically made for angular based application
Grunt: JavaScript task runner - automate various repetitive tasks such as js minification, reload server on change etc
$ npm install -g generator-webapp
$ npm install -g generator-angular
I am going to call my application angular_play for this test project
$ mkdir angular_play
open the directory you just created (angular_play in this case) from WebStorm
from WebStorm terminal interface, run the following to scaffold out a AngularJS project
$ yo angular
install a dependency for your project from Bower
$ bower install angular-ui
test your app
$ grunt test
preview your app (formerly `grunt server`)
$ grunt serve
build the application for deployment
$ grunt
Thank you YEOMAN!
2. Configure grunt server on WebStorm
"edit configuration"
select Node.js and enter following parameters:
play "Grunt Server"
3. Install AngularJS extension
WebStorm > Preferences > Install JetBeans plugins > Browse Repositories > "angluarjs" > double click search result and install
Ta-da! nice autocomplete and other support for all of the ng-goodness
4. Setup Debugger
4.1. with WebStorm:
WebStorm > Edit Config > add "JavaScript Debug" > Specify file you want to debug > Click debug
Every time you reload page, it stops at breakpoint you specified!
4.2. with AngularJS Batarang Chrome Extension:
You can install AngularJS Batarang Chrome debugging extension for debugging and profiling. This performance tab comes in handy when you use function like $watch (listen for change)
4.3. Set "Pause on all exceptions" to halt when an exception occurs
5. Let generator do the job
Why not use generator?
from WebStorm terminal, just run command available
6. Study & Get Help
egghead.io: web development training with AngularJS
Lastly....
Comments
Post a Comment