Een introductie
AngularJS is a structural framework for dynamic web apps. It lets you use HTML as your template language and lets you extend HTML's syntax to express your application's components clearly and succinctly.
AngularJS is what HTML could have been if it had been designed for web application development
- Miško Hevery, de man met het plan
* DOM = HTML + Directives
<html ng-app>
<body>
<h1>Databinding</h1>
<input ng-model="user.name" placeholder="naam">
<input ng-model="user.lastname" placeholder="achternaam">
<p ng-show="user.name || user.lastname">
Hoi {{user.name}} {{user.lastname}}
</p>
<script src="angular.min.js"></script>
</body>
</html>
<html ng-app="mvcExample">
<body ng-controller="UserCtrl as userCtrl">
<h1>Databinding MVC</h1>
<input ng-model="userCtrl.user.name" placeholder="naam">
<input ng-model="userCtrl.user.lastname" placeholder="achternaam">
<p ng-show="userCtrl.user.name || userCtrl.user.lastname">
Hoi {{userCtrl.user.name}} {{userCtrl.user.lastname}}
</p>
<button ng-click="userCtrl.shout()">roep</button>
<script src="angular.min.js"></script>
<script>
angular.module('mvcExample', [])
.controller('UserCtrl', UserCtrl);
function UserCtrl() {
this.user = {
name: 'John',
lastname: 'Doe'
};
this.shout = function() {
alert((this.user.name + ' ' + this.user.lastname).toUpperCase());
};
}
</script>
</body>
</html>
<html ng-app="mvcExample">
<body ng-controller="UserCtrl">
<h1>Databinding MVC</h1>
<input ng-model="user.name" placeholder="naam">
<input ng-model="user.lastname" placeholder="achternaam">
<p ng-show="user.name || user.lastname">
Hoi {{user.name}} {{user.lastname}}
</p>
<button ng-click="shout()">roep</button>
<script src="angular.min.js"></script>
<script>
angular.module('mvcExample', [])
.controller('UserCtrl', UserCtrl);
function UserCtrl($scope) {
$scope.user = {
name: 'John',
lastname: 'Doe'
};
$scope.shout = function() {
alert(($scope.user.name + ' ' + $scope.user.lastname).toUpperCase());
};
}
</script>
</body>
</html>
AngularJS docs: https://docs.angularjs.org
Populaire AngularJS modules: http://ngmodules.org/
Bite-size Tutorials: https://egghead.io/
Docs voor vanalles: http://devdocs.io/
In depth tutorial (frontend masters) : http://bit.ly/1FVGr0F
Codeschools Tutorials: http://bit.ly/1p3XWCj
@zimmen - simon@zimmen.com