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 id='click' ng-click="data = 'change'">click to 'change'</button>
<my-div>watch, this doesn't change!!!???</my-div>
</div>
JavaScript
var myApp = angular.module('myApp', []);
myApp.directive('myDiv', function($compile) {
return {
restrict: 'E',
//link: function(scope, element, attrs) {
// here adding the ng-bind dynamically
// element.html($compile(angular.element('<div ng-bind="data">me</div>'))(scope));
//}
template: '<div ng-bind="data">me</div>'
};
});
//myApp.factory('myService', function() {});
function MyCtrl($scope) {
$scope.name = 'Superhero';
}