Tuesday, October 21, 2014

CodePen + AngularJS + Firebase = A Complete Demo App in the Cloud

Can you build a complete web app in CodePen? You can with AngularJS + Firebase/AngularFire. I will leave this contacts app up and public for a few weeks so you can check it out.

This was a demo for my AngularJS weekend class. It is amazing how much you can build in so few lines of code. 

Rule the clouds!

See the Pen finished-firebase-contacts by Troy Miles (@Rockncoder) on CodePen.

Cross Platform Mobile Apps with the Ionic Framework

Here are the slides from my talk on the Ionic Framework.

Monday, October 20, 2014

CodePen, AngularJS, and Jasmine!

Online Web editors, like JSbin, plnkr, and CodePen, are awesome. They allow you to easily work on an idea without all of the muss and fuss of having to spin up a server. You can also share the idea with friends or the entire Internet easily. 

Unit test is something that all developers, especially AngularJS ones, are encouraged to do. I work on a lot of angular ideas initially in CodePen. I also write unit test in Jasmine, but getting the two to play nice together in CodePen wasn't as easy as I thought it should be. 

In the pen below I show how to get the two working together. The main trouble I was having was the order of the files. It has to be as follows:

  1. jasmine.css
  2. jasmine.js
  3. jasmine-html.js
  4. boot.js 
  5. angular.js
  6. angular-mocks.js
If you get the order wrong, you may get errors like: ReferenceError: inject is not defined or ReferenceError: module is not defined. These can make you think something is wrong with your code when there isn't. 

The pen below is written using Jasmine 2.0 and AngularJS 1.26.

See the Pen finished-jasmine-unit-test by Troy Miles (@Rockncoder) on CodePen.