Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close

AngularJS last.FM Application

Overview

This application started out as the Angularjs Tutorial but I've now merged away from it and have integrated the last.FM api to kind of learn from my own after reviewing the tutorial.

I've tried to update the prerequisites below so that they fit this new application.

Prerequisites

Git

  • A good place to learn about setting up git is here
  • Git home (download, documentation)

Node.js

Java

  • http://www.java.com

Workings of the application

  • The application filesystem layout structure is based on the angular-seed project.
  • There is no true backend (no server) for this application.
  • Read the Development section at the end to familiarize yourself with running and developing an angular application.

Development with angular-seed

The following docs apply to all angular-seed projects and since the phonecat tutorial is a project based on angular-seed, the instructions apply to it as well.

Running the app during development

  1. run ./scripts/web-server.js
  2. navigate your browser to http://localhost:8000/app/index.html to see the app running in your browser.

Running unit tests

Requires java.

  1. start ./scripts/test-server.sh (on windows scripts\test-server.bat)
  2. navigate your browser to http://localhost:9876/
  3. click on: capture strict link
  4. run scripts/test.sh (on windows scripts\test.bat)
  5. edit files in app/ or src/ and save them
  6. go to step 4.

Continuous unit testing

Requires ruby and watchr gem.

  1. start JSTD server and capture a browser as described above
  2. start watchr with watchr scripts/watchr.rb
  3. in a different window/tab/editor tail -f logs/jstd.log
  4. edit files in app/ or src/ and save them
  5. watch the log to see updates

End to end testing

angular ships with a baked-in end-to-end test runner that understands angular, your app and allows you to write your tests with jasmine-like BDD syntax.

Requires a webserver, node.js or your backend server that hosts the angular static files.

Check out the end-to-end runner's documentation for more info.

  • create your end-to-end tests in test/e2e/scenarios.js
  • serve your project directory with your http/backend server or node.js + scripts/web-server.js
  • open http://localhost:port/test/e2e/runner.html in your browser

Application Directory Layout

app/                --> all of the files to be used in production
  css/              --> css files
    app.css         --> default stylesheet
  img/              --> image files
  index.html        --> app layout file (the main html template file of the app)
  js/               --> javascript files
    controllers.js  --> application controllers
    filters.js      --> custom angular filters
    services.js     --> custom angular services
    widgets.js      --> custom angular widgets
  lib/              --> angular and 3rd party javascript libraries
    angular/
      angular.js            --> the latest angular js
      angular.min.js        --> the latest minified angular js
      angular-*.js  --> angular add-on modules
      version.txt           --> version number
  partials/         --> angular view partials (partial html templates)

config/jsTestDriver.conf    --> config file for JsTestDriver

logs/               --> JSTD and other logs go here (git-ignored)

scripts/            --> handy shell/js/ruby scripts
  test-server.bat   --> starts JSTD server (windows)
  test-server.sh    --> starts JSTD server (*nix)
  test.bat          --> runs all unit tests (windows)
  test.sh           --> runs all unit tests (*nix)
  watchr.rb         --> config script for continuous testing with watchr
  web-server.js     --> simple development webserver based on node.js

test/               --> test source files and libraries
  e2e/              -->
    runner.html     --> end-to-end test runner (open in your browser to run)
    scenarios.js    --> end-to-end specs
  lib/
    angular/                --> angular testing libraries
      angular-mocks.js      --> mocks that replace certain angular services in tests
      angular-scenario.js   --> angular's scenario (end-to-end) test runner library
      version.txt           --> version file
    jasmine/                --> Pivotal's Jasmine - an elegant BDD-style testing framework
    jasmine-jstd-adapter/   --> bridge between JSTD and Jasmine
    jstestdriver/           --> JSTD - JavaScript test runner
  unit/                     --> unit level specs/tests
    controllersSpec.js      --> specs for controllers

Contact

For more information on angular please check out http://angularjs.org/

Recent activity

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.