I built a random-color angular directive with a test on the same page. I started by using plunkr but gave up and used Bower because my connection was unreliable. I learned that angular-mocks is a counterpart to Jasmine in that it exports global variables for convenience. Also, angular-mocks must be loaded after Jasmine. I learned this the hard way.
This is a partial implementation of Markdown to show how it might be rendered in angular without asking its template engine to insert HTML.
This month my goal is to post a small JavaScript project every day of the month. Today’s project is an angular.js app for jumping between paragraphs using the keyboard. Besides navigating between paragraphs it can show paragraphs before or after the current paragraph without leaving the page. This could help if the reader needs to recall a detail from the last paragraph in order to fully understand the current paragraph.
I used these resources to help me get it done:
- How to listen for key presses with AngularJS – showed me that I wanted was keydown events on the body tag using ng-keydown
- 5apps – a lot like GitHub pages with Jekyll turned off, except I don’t need to create another branch. Unlike Heroku, free apps don’t go to sleep.