You are here

Playing with AngularJS

logoI'm almost a complete beginner in Javascript and AngularJS. For some time now, I've been considering starting playing with them, but had not managed to do so. Today, it seems the right opportunity appeared. So, let's go!

I'll start by following AngularJS v1.4.9 tutorial. I'll do this on a PC that runs Linux Mint 17.3 (a Linux distro derived from Ubuntu).

Intallation and configuration

  • git is already installed
  • download example application:

mkdir angular
cd angular
git clone --depth=14
  • install Node.js:
curl -sL | sudo -E bash -
sudo apt-get install -y nodejs
  • check version numbers for Node.js and npm:
node --version
# v5.8.0
npm --version
# v3.7.3
  • install tool dependencies:
cd angular-phonecat
npm install
  • several warnings:
npm WARN deprecated graceful-fs@3.0.8: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.8

I'll do with them for now...

First use of the development environment

  • to run the development web server:
npm start

The example application is visible at http://localhost:8000/app/index.html.

  • to run unit tests:
npm test

This command starts Chromium and Firefox, and runs predefined tests. If I close one of the browser windows, the test procedure reopens it. Impressive tooling...

The idea is to leave tests running in the background.

  • to run end to end tests, first install required driver for Protractor, the test runner:
npm run update-webdriver
  • then run the tests:
npm run protractor

Chromium is started, and various tests are automagically performed. In the end, Chromium window is closed. Again, impressive...

Now, that's time to really enter AngularJS world. The tutorial seems so well written that I won't go on rewriting it here. I'll wait till I produce my first own code before publishing a new article...

Meanwhile, I'll record below some links that seem important: