var directives = angular.module('satbd.satellite.bar.directives',[]) directives.directive('album', function() { return { scope: { id: '=albumId' }, templateUrl: 'js/directives/album.html', restrict: 'E', controller: 'AlbumCtrl' }; }); directives.controller('AlbumCtrl', function($scope,$http,$log,albumService) { albumService.get($scope.id) .then(function(data) { $scope.album = data; }, function(err) { $log.error('Could not fetch album' + $scope.id + ' :' + err); }); });