8. Serwis z danymi
● contacts
● json-generator
angular.module('workshop2App')
.factory('contacts', function () {
var exampleContacts = [ ... ];
// Public API here
return {
getAll: function () {
return exampleContacts;
},
get: function (id) {}
9. Underscore
● użyteczne funkcje
● dokumentacja
var evens = _.filter([1, 2, 3, 4, 5, 6], function(num){ return
num % 2 == 0; });
// => [2, 4, 6]
var sum = _.reduce([1, 2, 3], function(memo, num){ return
memo + num; }, 0);
// => 6
_.isString(object)
_.isNumber(object)
19. Zadanie 2: zastosowanie animacji
● animowanię zmiany wyświeltanych
elementów
● git checkout todo-2
● implementacja: app/views/showContacts.
html & app/styles/main.css
26. Zadanie 3: tracking cookies
● git checkout todo-3
● implementacja:
app/scripts/controllers/global.js
● Jeśli nie ma 'trackingId' na ciasteczku -
ustawamy je na nowo wygenerowany UUID
31. Zadanie 4: template dla ws-accept-
cookies
● git checkout todo-4
● przykład użycia: app/index.htm +27
● implementacja: app/scripts/directives/ws-
accept-cookies.js
● to co jest oryginalnie wewnatrz tagu chcemy
mieć wciąż w directive + chcemy mieć guzik
'accept'