8:00 – 4:00 SR
- DB Backups
- Printed out python script for the FY chart export to Visibility.
- Angular
- Playing around with Plunker as a place to archive my hard-won lessons
8:00 – 4:00 SR
8:00 – 6:00 SR
| Directive | Supported animations |
| ngRepeat | Enter, leave, and move |
| ngView | Enter and leave |
| ngInclude | Enter and leave |
| ngSwitch | Enter and leave |
| ngIf | Enter and leave |
| ngClass | Add and remove |
| Add and remove | |
| form and ngModel | Add and remove |
| ngMessages | Add and remove |
| ngMessage | Enter and leave |
A better ng-class example (here in plunker):
The CSS classes. Note that the ‘base-class’ contains the animation timings:
.base-class {
width: 200px;
height: 50px;
text-align: center;
margin: 10px;
padding: 10px;
-webkit-transition: background-color 1s, color 1s, border-color 1s;
transition: background-color 1s, color 1s, border-color 1s;
}
.base-class.whiteBackground {
background-color: white;
color: black;
border: 3px solid black;
}
.base-class.blackBackground {
background-color: black;
color: white;
border: 3px solid white;
}
.base-class.greenBackground {
background-color: green;
color: yellow;
border: 3px solid yellow;
}
.base-class.blueBackground {
background-color: blue;
color: magenta;
border: 3px solid magenta;
}
.base-class.redBackground {
background-color: red;
color: cyan;
border: 3px solid cyan;
}
The Angular code that cycles through the classes:
<body>
<link href="ngClassSample.css" rel="stylesheet" />
<div ng-controller="MyApp as ma">
<h1>ngClass Animation</h1>
<div>
<button ng-click="ma.doToggle()">Next !</button>
<div class="base-class" ng-class="ma.getAnimationClass()">
This is the 'ugly sweater' of css animations
</div>
</div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular-animate.min.js"></script>
<script>
var app = angular.module('myApp', ['ngAnimate']);
app.controller('MyApp', [function(){
var self = this;
var classArray = ['', 'blackBackground', 'whiteBackground', 'greenBackground', 'blueBackground', 'redBackground'];
self.toggle = 0;
self.doToggle = function(){
self.toggle++;
}
self.getAnimationClass = function(){
var index = self.toggle%classArray.length;
return classArray[index];
}
}]);
</script>
</body>
8:00 – 1:00, 3:00 – 7:00
Using Transitions
/* ngIf animation */
.animIf.ng-enter {
/* if the value is true */
-webkit-transition: opacity linear 0.1s;
-moz-transition: opacity linear 5.0s;
-ms-transition: opacity linear 5.0s;
-o-transition: opacity linear 5.0s;
transition: opacity linear 5.0s;
}
.animIf.ng-leave {
/* if the value is false */
-webkit-transition: opacity linear 5s;
-moz-transition: opacity linear 5s;
-ms-transition: opacity linear 5s;
-o-transition: opacity linear 5s;
transition: opacity linear 5s;
}
.animIf.ng-enter,
.animIf.ng-leave.ng-leave-active {
opacity: 0.0;
}
.animIf.ng-leave,
.animIf.ng-enter.ng-enter-active {
opacity: 1;
}
Using keyframes:
.listStyle.ng-enter {
-webkit-animation: 5s enterKeyframes;
-moz-animation: 5s enterKeyframes;
-ms-animation: 5s enterKeyframes;
-o-animation: 5s enterKeyframes;
animation: 5s enterKeyframes;
}
@keyframes enterKeyframes {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.listStyle.ng-leave {
-webkit-animation: 5s leaveKeyframes;
-moz-animation: 5s leaveKeyframes;
-ms-animation: 5s leaveKeyframes;
-o-animation: 5s leaveKeyframes;
animation: 5s leaveKeyframes;
}
@keyframes leaveKeyframes {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
I don’t know about you, but to me, the second seems much clearer.
8:00 – 6:00 SR
8:00 – 10:00, 12:00 – 4:00 SR
7:30 – 4:30 SR
Directive javascript:
pa.directive('oldPost', ['$window', function($window) {
return {
templateUrl: 'directives/oldPost.html',
restrict: 'AE',
scope: {pobj: '='}
}
}]);
Directive HTML (directives.oldPost.html):
<div class="inputWrapper">
<div class="textLabel">Posted: {{pobj.postDate}}</div>
<textArea class="textAreaOutput" ng-model="pobj.postText" ng-disabled="true"></textArea>
</div>
Master HTML:
<div ng-repeat="pobj in mainCtrl.postItems"> <old-post pobj = "pobj"></old-post> </div>
7:30 – 4:00 SR
7:30 – 5:30 SR
7:30 – 3:00 SR
Phil 8:00 – 4:00
You must be logged in to post a comment.