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