AngularJS Sticky Notes
Thanks Ali Mills for the inspiration!
http://jsfiddle.net/alimills/rCbMv
And Thomas Burleson for some great feedback on the code.
HTML
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<script src="http://code.angularjs.org/1.0.0/angular-1.0.0.js"></script>
<div my-bind="scopeVar"></div>
JavaScript
angular.module('mod', []).
directive('myBind', function() {
return {
restrict : 'A',
scope : {
scopeVar : '@'
},
link : function(scope,element,attr){
element.attr('ng-bind', scope.scopeVar);
element.text(scope.scopeVar);
}
};
});
var app = angular.module('app', [ 'mod' ]);
angular.element(document).ready(function() {
angular.module('app').run(function($rootScope){
$rootScope.scopeVar = 'This is scope variable.';
});
angular.bootstrap(document, ['app']);
});