
@ZenikaIT
@olivierhuber
@ZenikaIT
@LyonJS
@Swiip
<html><head><script src="angular.js"></script></head><body><h1 ng-bind="hello"></h1><input type="text" ng-model="hello"></body></html>
<html><head><script type="text/javascript">... ? ... ? ...</script></head><body><h1 ng-bind="hello"></h1><input type="text" ng-model="hello"></body></html>

<html><body><h1 ng-bind="hello"></h1><input type="text" ng-model="hello"><script type="text/javascript">/* Angular from scracth */</script><script type="text/javascript">/* Utilisation du framework */</script></body></html>

"A JavaScript library that provides a whole mess of useful functional programming helpers without extending any built-in objects."
<script src="underscore.js"></script><script>var a = [1, 2, 3];var b = _.map(a, function(num){return num * 3;});console.log(a);console.log(b);</script>
"Le scope est un simple Plain Old JavaScript Object sur lequel on attache autant de propriétés que l'on a besoin"
<script>function Scope() {}</script>
<script>var myScope = new Scope();myScope.firstName = "Alice";myScope.age = 35;console.log(myScope);</script>
"La magie n'est donc pas dans le scope mais dans ces deux fonctions qui vont faire en sorte qu'Angular "réagisse" aux changements"
Scope.prototype.$watch =function(watchFn, listenerFn) {this.$$watchers.push({watchFn:watchFn,listenerFn:listenerFn});};
Scope.prototype.$digest =function() { _.each(this.$$watchers, function(watch){ watch.listenerFn(); }); }
myScope.$watch(function(){return myScope.firstName;}, function(){console.log("listen on firstName");});myScope.$digest();