Here's an example of it working: http://plnkr.co/edit/ye2p8NQEDvdzLjtJSQnO?p=preview