Angular: Empty Fiddle
http://angularjs.org/
by marcolepsy
HTML
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<div ng-controller="MyCtrl">
Hello, {{name}}!
<button ng-click="click()">click to 'change'</button>
<my-div>me</my-div>
</div>
JavaScript
var myApp = angular.module('myApp', []);
myApp.directive('myDiv', function() {
return {
restrict: 'E',
transclude: true,
template: '<div>{{data || "me"}}</div>'
};
});
//myApp.factory('myService', function() {});
function MyCtrl($scope) {
$scope.name = 'Superhero';
$scope.click = function() {
$scope.data = 'change';
};
}