Angular: Empty Fiddle
http://angularjs.org/
by boneskull
HTML
<script src="http://code.angularjs.org/1.1.5/angular.min.js"></script>
<div>
<startstop class="btn"></startstop>
</div>
JavaScript
var myApp = angular.module('myApp',[]);
myApp.directive('startstop', function() {
return {
restrict: 'E',
scope: {},
replace: true,
template: '<span><input value="{{myval}}" type="button" class="btn"></input></span>',
link: function(scope, element) {
scope.myval = 'Start';
element.bind('click', function() {
if(scope.myval === 'Start') {
scope.$apply('myval = "Stop"');
} else {
scope.$apply('myval = "Start"');
}
});
}
};
});