Richard Ramsden

ngConfirmClick directive

There are a few examples online how to create a confirm click directive. For this directive to work correctly you need to set priority to 0 or a negative value to prevent ngClick action from occurring before the confirm message.

  .directive('ngConfirm', function() {
    return {
      priority: 0,
        link: function(scope, element, attr) {
          var msg = attr.ngConfirm || "Are you sure?";
          var clickAction = attr.ngClick;
          attr.ngClick = "";
          element.bind('click', function(e) {
            if (window.confirm(msg)) {

Custom jasmine matchers and Karma

It’s really easy to use custom matchers with the Karma spec runner. Just open your karma configuration file and add the location you want your custom matchers to be. 

files: [

Inside this file you can add your matchers

beforeEach(function () {
		toBeFive: function() {
			return this.actual === 5;

Ember.Checkbox and bindings

Today I ran into an issue figuring out how to bind a model attributes properly to a checkbox in Ember.

Instead of valueBinding for regular form inputs you need to use checkedBinding when defining a checkbox.

Using Ember’s input helper:

    {{input type="checkbox" checkedBinding="model.attribute"}}