$ whoami
@terminon
github.com/bloveridge
bnjm.in/the-next-42
bnjm.in/the-next-42-feedback
joind.in/14021
Google Search Trends, Jan 2013 - May 2015
© Christos Georghiou
<html ng-app ng-controller="formCtrl">
<head>
<script src="angular.min.js"></script>
</head>
<body>
<form>
<label>Age:</label>
<input type="text"
ng-model="yourAge"
pattern="^[0-9]+$"
required>
<h1>You are already {{age}}?</h1>
</form>
</body>
</html>
<html ng-app ng-controller="formCtrl">
<head>
<script src="angular.min.js"></script>
</head>
<body>
<form>
<label>Age:</label>
<input type="text"
ng-model="yourAge"
pattern="^[0-9]+$"
required>
<h1>You are already {{age}}?</h1>
</form>
</body>
</html>
<html ng-app ng-controller="formCtrl">
<head>
<script src="angular.min.js"></script>
</head>
<body>
<form>
<label>Age:</label>
<input type="text"
ng-model="yourAge"
pattern="^[0-9]+$"
required>
<h1>You are already {{age}}?</h1>
</form>
</body>
</html>
books.forEach(function(book) {
$('<div>')
.append(book.title)
.append(', by ')
.append(book.author)
.appendTo(document.body);
});
books.forEach(function(book) {
$('<div>')
.append(book.title)
.append(', by ')
.append(book.author)
.appendTo(document.body);
});
<body ng-controller="mainCtrl as main">
<div ng-repeat="book in main.books">
{{book.title}}, by {{book.author}}
</div>
</body>
$(myDiv).on('click', function($event) {
mainCtrl.handleClick();
$event.stopPropagation();
};
$(myDiv).on('click', function($event) {
mainCtrl.handleClick();
$event.stopPropagation();
};
<body ng-controller="mainCtrl as mainCtrl">
<div ng-click="
mainCtrl.handleClick();
$event.stopPropagation();
">Click me!</div>
</body>
$(myDiv).on('click', function($event) {
mainCtrl.handleClick();
$event.stopPropagation();
};
<body ng-controller="mainCtrl as mainCtrl">
<div ng-click="
mainCtrl.handleClick();
$event.stopPropagation();
">Click me!</div>
</body>
Think of directives like functions within HTML.
- Matias Niemelä
<!-- directive:outline blue -->
Really delete?
<input class="confirm"
ng-model="confirm"/>
<input
x-autofocus="confirm === 'YES'"/>
<span>Span 1</span
><span class="available-width">
Fill the rest.</span
><span>Span 2</span>
<body ng-controller="MainCtrl as main">
<carousel images="main.portfolio"/>
</body>
app.directive('datePicker', function() {
return {
restrict: 'MACE',
replace: true | false,
scope: true | false | Object,
template: '<div> ... </div>',
link: function(scope, elem, attrs) {
// awesome things
}
};
});
<date-picker>
<datePicker>
$ git clone -b step1 https://github.com/
bloveridge-demos/the-next-42.git
bnjm.in/the-next-42-feedback
joind.in/14021