moving the checkbox code into a directive, so I can reuse it in an app