Skip to content

Instantly share code, notes, and snippets.

@takashi
Created April 28, 2015 16:14
Show Gist options
  • Select an option

  • Save takashi/59d2b570f7474340e1b9 to your computer and use it in GitHub Desktop.

Select an option

Save takashi/59d2b570f7474340e1b9 to your computer and use it in GitHub Desktop.
angular.module('moduleName')
.controller('TestController', function($scope) {
$scope.onFileSet = function(file) {
var reader = new FileReader();
reader.onload = function(e) {
$scope.$apply(function() {
$scope.article.thumbnail.url = e.target.result;
});
}
reader.readAsDataURL(file)
}
})
// <div ng-controller="TestController" >
// <img ng-src="{{article.thumbnail.url}}" alt="" width="125px" height="125px" ng-if="article.thumbnail.url.length">
// </div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment