32. DIREKTIVEN
• HTML Attribute
• Verhalten oder DOMTransformation
• Built-ins und eingene Direktiven
• Eigene Direktiven
• z.B. ngApp, ngController, ngRepeat
Wednesday, June 26, 13
45. DEPENDENCY INJECTION
• Strukturierung - Komponenten für Model,View, Controller
• Lose Kopplung - DI löst Abhängigkeiten auf
• DI stellt Services zurVerfügung
• Caching Mechanismus
Wednesday, June 26, 13
50. • Geben den Bootstrap-Prozess einer Applikation vor
• Service Modul
• Directive Modul
• Filter Modul
• Application Modul
MODULE
Wednesday, June 26, 13
51. MODULE
var myApp = angular.module('myApp', []);
myApp.controller('MovieListCtrl',
['$scope', '$http', function ($scope, $http) {
$http.get('/movies').success(function(data) {
$scope.films = data;
});
}]);
Wednesday, June 26, 13
52. MODULE
var myApp = angular.module('myApp', []);
myApp.controller('MovieListCtrl',
['$scope', '$http', function ($scope, $http) {
$http.get('/movies').success(function(data) {
$scope.films = data;
});
}]);
Wednesday, June 26, 13
59. it ("should fetch a list with one movie", function () {
expect(scope.films).toBeUndefined();
$httpBackend.flush();
expect(scope.films).toEqual(
[{"name": "Matrix", "year": 2005, "genre": "Sci-Fi"}]
);
});
Wednesday, June 26, 13
60. UNITTESTS
$ ./scripts/test.sh
Starting Karma Server (http://karma-runner.github.io)
-------------------------------------------------------------------
INFO [karma]: Karma server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [launcher]: Starting browser Firefox
INFO [Firefox 21.0 (Mac)]: Connected on socket id 8lw9q3ZBbNpAb7rc3RpS
INFO [Chrome 27.0 (Mac)]: Connected on socket id KI5wy1rfgkIU32cP3RpR
Firefox 21.0 (Mac): Executed 4 of 4 SUCCESS (0.134 secs / 0.037 secs)
Chrome 27.0 (Mac): Executed 4 of 4 SUCCESS (0.157 secs / 0.044 secs)
TOTAL: 8 SUCCESS
Wednesday, June 26, 13
68. E2E
./scripts/e2e-test.sh
Starting Karma Server (http://karma-runner.github.io)
-------------------------------------------------------------------
[2013-06-22 10:26:07.404] [WARN] config - "/" is proxied, you should
probably change urlRoot to avoid conflicts
INFO [karma]: Karma server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 27.0 (Mac)]: Connected on socket id 4YaYP4NBBNKlOgDS_YbA
Chrome 27.0 (Mac): Executed 1 of 1 SUCCESS (0.385 secs / 0.189 secs)
Wednesday, June 26, 13