(function(){ 'use strict'; angular.module('shared') .component('profilePhoto', { templateUrl: '/shared/js/angular/profile-photo-upload/profile-photo.template.html', controller: 'profilePhotoController', bindings: { pictureData: '<' }, }) .controller('profilePhotoController', ['$scope', function profilePhotoController ($scope){ var ctrl = this; ctrl.$onInit = function(){ ctrl.photo = ctrl.pictureData.profilePic; $scope.photo = ctrl.photo; ctrl.name = ctrl.pictureData.name; ctrl.hasPhoto = ctrl.pictureData.hasProfilePic; } $scope.callback = function(newPhoto){ var date = new Date(); var time = date.getTime(); $scope.photo = newPhoto + '?time=' + time; } }]); })();