client/app/components/app_service.js
changeset 172 ffdfe491869c
parent 146 c6fa8ee3f562
child 178 a3e1106b6f96
--- a/client/app/components/app_service.js	Thu Jun 11 15:38:19 2015 +0200
+++ b/client/app/components/app_service.js	Thu Jun 11 16:19:36 2015 +0200
@@ -27,7 +27,7 @@
                 modalInstance.result.then(function (idBook) {
                     var newSlide = _this;
                     newSlide.book = idBook;
-                    delete newSlide["id"];
+                    delete newSlide.id;
                     slides.save(newSlide);
                 });
             },
@@ -41,7 +41,7 @@
                         if (array){
                             array.splice(array.indexOf(_this), 1);
                         }
-                        //$scope.$emit("slideDeleted", array);
+                        //$scope.$emit('slideDeleted', array);
                     },
                     function(error) {
                         if (error.status === 404 && array){
@@ -104,22 +104,23 @@
                     });
         };
     })
-    .directive('myCustomer', function(){
+    .directive('imgType', function(){
         return {
-            link: function(scope, elem, attr) {
+            restrict: 'AE',
+            link: function(scope, elem) {
                 elem.bind('error', function() {
                     elem.parents('li.item').addClass('no-img');
                     elem.remove();
                 });
                 elem.on('load', function() {
-                    var w = $(this).width(),
-                        h = $(this).height();
+                    var w = elem.width(),
+                        h = elem.height();
                     if (w > h){
-                        $(this).addClass('img-landscape');
+                        elem.addClass('img-landscape');
                     }
                 });
             }
-        }
+        };
     });
     
 })();